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)
 Dynamic WHERE IN clause

Author  Topic 

cwhite85
Starting Member

6 Posts

Posted - 2003-10-20 : 16:31:43
I have a stored procedure that takes in an array of ids.

How can I return fields where the id in the array matches the id in the returned fields (without using dynamic sql)?

For example

create procedure test

(
@IDs varchar(1000)
)

-- @IDs has value of '1, 2, 3'

select * from tables where table_id in (@IDs)

Go


Any thoughts.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-20 : 16:33:35
[url]http://www.sqlteam.com/item.asp?ItemID=11499[/url]

Tara
Go to Top of Page

cwhite85
Starting Member

6 Posts

Posted - 2003-10-20 : 18:08:03
Thanks Tara, I was looking all over the site for an article for that.
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2003-10-21 : 10:40:19
FYI - Moved out of the article discussion forum.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -