hi,
in SQL Server Books Online in sp_executesql page thay have this example:
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl = @.level',
N'@.level tinyint',
@.level = 35
i need to accomplish a similar task, but with un-predictable (may be dozens
of) numbers of parameters.
so, instead of doing something like this (with much more than two
parameters):
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl = @.level or
job_lvl = @.level2',
N'@.level tinyint , @.level2 tinyint',
@.level = 35
,@.level2 = 32
i want to do something like this:
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl in ( @.level ) ',
N'@.level '? ',
@.level = 35,32
which does not work ,of course......
any ideas?
thanks,
edoSee if this helps:
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"edo" <ewilde@.nana.co.il> wrote in message
news:efwHDCdhEHA.556@.tk2msftngp13.phx.gbl...
hi,
in SQL Server Books Online in sp_executesql page thay have this example:
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl = @.level',
N'@.level tinyint',
@.level = 35
i need to accomplish a similar task, but with un-predictable (may be dozens
of) numbers of parameters.
so, instead of doing something like this (with much more than two
parameters):
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl = @.level or
job_lvl = @.level2',
N'@.level tinyint , @.level2 tinyint',
@.level = 35
,@.level2 = 32
i want to do something like this:
execute sp_executesql
N'select * from pubs.dbo.employee where job_lvl in ( @.level ) ',
N'@.level '? ',
@.level = 35,32
which does not work ,of course......
any ideas?
thanks,
edo
No comments:
Post a Comment