Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2008-12-15 : 16:51:09
|
| Is it possible to get the result in comma seperated with this select query:select distinct(Orderid) from tab_orders where Company=@companyresult @Orderid: "1,2,3,4"I am expecting less than 10 rows any time.Once i get the above comma seperated result, can i use it with this query?select fund_id,fundid,efund_amt from Tab_orderfunds where Orderid in (@Orderid)Thank you for the help. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-15 : 16:54:37
|
| Can you post sample data and output so it is clear? |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-15 : 19:21:25
|
| http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-15 : 23:44:51
|
| [code]DECLARE @OrderIDList varchar(max)SELECT @OrderIDList=ol.OrdListFROM (SELECT distinct CAST(Orderid AS varchar(20)) + ',' FROM tab_orders where Company=@company FOR XML PATH(''))ol(OrdList)select fund_id,fundid,efund_amt from Tab_orderfunds where ','+ @OrderIDList LIKE '%,' + CAST(Orderid AS varchar(20)) + ',%'[/code] |
 |
|
|
|
|
|