Stored procedure for selecting multiple records
Posted
by padmavathi
on Stack Overflow
See other posts from Stack Overflow
or by padmavathi
Published on 2010-04-26T12:06:30Z
Indexed on
2010/04/26
12:13 UTC
Read the original article
Hit count: 175
I need to select records say 2000 from a table with a matching timestamp from c# .net code. Eg:
SELECT *
FROM ITEMDATA_TABLE
WHERE ITEMNAME='Item1' and TimeStamp='2010-04-26 17:15:05.667'
The above query has to execute for 2000 items more for the same timestamp.
for this we can use
SELECT *
FROM ITEMDATA_TABLE
WHERE ITEMNAME in ('Item1','Item2','Item3','Item4',......)
AND TimeStamp='2010-04-26 17:15:05.667'
from SQL Server Management Studio.
I have tried appending all Item names to one string variable and giving it as a parameter to the stored procedure,but it resulted into a wrong concatenation.
How can I do this as a stored procedure executing from the .net code? Can anyone suggest me/correct me in doing this?
Thanks & Regards
Padma
© Stack Overflow or respective owner