all groups > sql server programming > november 2003 >
You're in the

sql server programming

group:

Basic Stored Procedure query


Basic Stored Procedure query Derek
11/26/2003 11:36:57 PM
sql server programming: I have the following code as a stored procedure

CREATE PROCEDURE [dbo].[UpdateTblState3]
AS
Begin
DECLARE @PersonID varchar(100)
Set @PersonID = '(2, 3)'
DELETE from tblState WHERE PersonID IN @PersonID
End
Go

However it is not passing the syntax check. However if I
make @PersonID an int and make it equal to 1 number it
works.

I'm pretty sure this is simple. Please let me know how
to do it.

Thanks
Re: Basic Stored Procedure query Roji. P. Thomas
11/27/2003 1:30:30 PM
This sems to be the most frequently asked question here.

you have two options I think.

Split the valus to a table and do a join
or use dynamic SQL.

Two links worth readings are
http://www.algonet.se/~sommar/arrays-in-sql.html

http://www.algonet.se/~sommar/dynamic_sql.html



--
Roji. P. Thomas
SQL Server Programmer ;)
________________________
[quoted text, click to view]

AddThis Social Bookmark Button