Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 anyway to avoid dynamic sql?

Author  Topic 

Ned
Starting Member

16 Posts

Posted - 2003-12-16 : 19:00:11
Hi,
I have a comma delimited list that I need to pass into a sql statement. I'm at a loss on how to avoid dynamic sql. I've tried many combinations of quotes (single and double) and I'm beginning to think it is not possible. I need to treat each item as a seperate value and not as one string.

declare @test varchar(1000)
SET @test = '''Item1'',''Item2'''
SELECT Coverage FROM HomeCoverages WHERE ControlName IN (@test)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-16 : 19:04:44
http://www.sqlteam.com/item.asp?ItemID=11499

Tara
Go to Top of Page
   

- Advertisement -