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

sql server programming

group:

Passing character data to procedure


Re: Passing character data to procedure Greg
9/23/2003 5:15:25 PM
sql server programming:
You can use dynamic SQL. Read in BOL.

Greg

[quoted text, click to view]
Re: Passing character data to procedure Aaron Bertrand - MVP
9/23/2003 5:19:20 PM
http://www.aspfaq.com/2248



[quoted text, click to view]

Passing character data to procedure Dariusz Hoszowski
9/23/2003 11:14:39 PM
Hi,
I wonder how to pass to procedure something that could be used in the IN
clause, for example:

I wan't to call EXEC test @tmp
where @tmp = '01', '02', '03', '04'
then i wan't to do (in procedure test):
Select * from something where value IN @tmp

but it didn't work - when i write it exactly Select * from something where
value IN ('01', '02', '03', '04') then it's working...

I don't know how to pass that parameters to function or procedure
Thanks for help

With best regards
Dariusz Hoszowski

Re: Passing character data to procedure Vishal Parkar
9/24/2003 7:38:56 AM
make use of dynamic sql.
Ex:

declare @tmp varchar(500)
set @tmp = '''01'', ''02'', ''03'', ''04''' --double up the single quotes in string.
exec ('Select * from something where value IN (' + @tmp + ')') --call the dynamically created
string


--
- Vishal
[quoted text, click to view]

AddThis Social Bookmark Button