1. --Creat a table containing some words.
    DECLARE @tblWordList table (ID int, words varchar(255), DOB datetime)


    INSERT @tblWordList (id, words, DOB)
    SELECT 1, 'aaa', SYSDATETIME()
    UNION ALL
    SELECT 2, 'bbb', SYSDATETIME()
    UNION ALL
    SELECT 3, 'ccc', SYSDATETIME()
    UNION ALL
    SELECT 4, 'ddd', SYSDATETIME()

    select * from @tblWordList
    0

    Add a comment

  2. --USE cursor to remove invalid words from a table.



    --Creat a table containing bad words
    DECLARE @tblWordsToAvoidList table (sInvalidWords varchar(255))
    INSERT @tblWordsToAvoidList (sInvalidWords)
    SELECT ( 'aaa')
    UNION ALL
    SELECT ( 'eee')



    --Creat a table containing some words.
    DECLARE @tblWordList table (words varchar(255))
    INSERT @tblWordList (words)
    SELECT ( 'aaa')
    UNION ALL
    SELECT ( 'bbb')
    UNION ALL
    SELECT ( 'ccc')
    UNION ALL
    SELECT ( 'ddd')


    --Display the initial tables.
    SELECT * FROM @tblWordList
    SELECT * FROM @tblWordsToAvoidList


    --Remove bad words from list of words
    DECLARE @badWord VarChar(255)


    DECLARE Word_Cursor CURSOR
    FOR SELECT sInvalidWords
    FROM @tblWordsToAvoidList

    OPEN Word_Cursor
    FETCH NEXT FROM Word_Cursor INTO @badWord
    WHILE (@@FETCH_STATUS <> -1)
    BEGIN
    UPDATE @tblWordList
    SET words = REPLACE(words,@badWord, '')
    FETCH NEXT FROM Word_Cursor INTO @badWord
    END
    CLOSE Word_CURSOR



    --display results
    SELECT * FROM @tblWordList
    SELECT * FROM @tblWordsToAvoidList


    --delete @tblWordList
    --delete @tblWordsToAvoidList
    0

    Add a comment

  3. If you are getting this error check the following:

    1: Right click on References
    2: Add the reference to the assembly that is missing (this might be another project that you have).
    3: In using section (imports for VB.NET) add:
    Using AssmblyName

    Also, make sure that the Target Framework are same for both assmeblies (the one that is being called and the calling project).

    Check Build Action is set to Compile.
    0

    Add a comment

Blog Archive
Topics
Topics
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.