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)
 IN Statement and stored proc question

Author  Topic 

brandonl
Yak Posting Veteran

58 Posts

Posted - 2005-10-14 : 11:39:08
I have a query:

SELECT ORDER_ID, DATETIME_STAMP
FROM ORDERS
WHERE ORDER_ID IN(1,2,3,4)


I want tochange the IN to a variable passed through to the procedure. The problem I am running into is making it a varchar field means the IN won't function. The ORDER_ID is INT.

Is there some way I can split the variable into an array or something, and then make that the variable, so the IN works correctly?

~BrandonL

Kristen
Test

22859 Posts

Posted - 2005-10-14 : 11:46:04
See the "CSV / Splitting delimited lists" section in the "Frequently Given Answers" topic at the top of the "New to SQL Server" forum

Kristen
Go to Top of Page

brandonl
Yak Posting Veteran

58 Posts

Posted - 2005-10-14 : 11:47:56
quote:
Originally posted by Kristen

See the "CSV / Splitting delimited lists" section in the "Frequently Given Answers" topic at the top of the "New to SQL Server" forum

Kristen

Great, thanks!

~BrandonL
Go to Top of Page
   

- Advertisement -