• Good article. For case 1 you could use a function in sql 2000 to simplify the static sql to...

    select * from authors WHERE au_lname IN (SELECT * FROM list_to_table('white,green'))

    where the function is...

    create function list_to_table (@list varchar(8000))

    returns @t table (list_item varchar(100))

    as

    begin

    DECLARE @len int, @CurPos int, @PrevPos int

    SET @len = LEN(@list) + 1

    SET @CurPos = 1

    SET @PrevPos = @CurPos

    WHILE @CurPos < @len + 1

    BEGIN

    IF SUBSTRING(@list + ',', @CurPos, 1) = ','

    BEGIN

    INSERT INTO @t (list_item)

    SELECT SUBSTRING(@list, @PrevPos, @CurPos - @PrevPos)

    SET @PrevPos = @CurPos + 1

    END

    SET @CurPos = @CurPos + 1

    END

    return

    end

    Just a thought.

    Ryan.

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.