Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

combine multiple rows into one dynamically query question Expand / Collapse
Author
Message
Posted Wednesday, March 6, 2013 1:19 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, October 9, 2014 2:38 PM
Points: 64, Visits: 159
What code should I use in SQL 2000 then?
Post #1427608
Posted Wednesday, March 6, 2013 2:35 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 12:57 PM
Points: 546, Visits: 1,062
something along the lines of...
Declare @assignTo nvarchar(4000) 
select @assignTo = Coalesce(@assignTo + ', ', '') + CAST(Name as nvarchar(250))
from
table2
where
...
Select @assignTo

but fair warning that won't work in a subquery..to use it in a correlated subquery you'll have to write it into a UDF with table access.

Umm....as far as I know. It's been a while.
Post #1427639
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse