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
See if this helps:
http://vyaskn.tripod.com/passing_arr...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
Friday, March 9, 2012
dose not SQL-Server has Array data-type?
Labels:
array,
books,
data-type,
database,
dbo,
employee,
exampleexecute,
job_lvl,
microsoft,
mysql,
online,
oracle,
page,
pubs,
server,
sp_executesql,
sp_executesqlnselect,
sql,
sql-server,
thay
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment