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
 SQL Server Development (2000)
 Error with the IN clause.

Author  Topic 

jesus4u
Posting Yak Master

204 Posts

Posted - 2004-06-18 : 11:07:37
I should have seen this but I still want to use this proc this way.
I can't seem to update the table using the IN clause because the InvoiceID is an integer and the @OrderIDs is a comma separated list ('28,29') of InvoiceIDs that I want to update.


CREATE PROCEDURE CancelOrders
@OrderIDs varchar(5000)
AS
UPDATE Orders SET Status = 'cancelled' WHERE InvoiceID IN (@OrderIDs)
GO


Please help.
Thanks

X002548
Not Just a Number

15586 Posts

Posted - 2004-06-18 : 11:18:10
The number one asked SQL Team question:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=udf,csv,string



Brett

8-)
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-06-18 : 11:32:12
And I like to point out:

where charindex(',' + InvoiceId + ',', ',' + @OrderIds + ',')>0

though it may be slower if it is a huge table.


Corey
Go to Top of Page
   

- Advertisement -