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 |
|
mdanwerali
Starting Member
30 Posts |
Posted - 2002-11-01 : 06:56:09
|
| Hi ,My procedure will fetch more than one record, then i want to concatenate those records and store in a field..for that i am using Set A = A +B....but Set should not be used in procedure then how to handle this problem..My Procedure is something like this---ALTER Procedure topiccontent(@topicid nchar(10),@topicdetails varchar(8000) OUTPUT)asDeclare c Cursor for select tpmdetailsfrom topicmaster where tpmtopicid = @topicidor (tpmowner =@topicid and tpmname like '%Cont...')order by tpmtopicidDeclare @tpcdetails varchar OPEN c FETCH NEXT FROM c INTO @topicdetails WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM c INTO @topicdetails ENDCLOSE cDEALLOCATE c--here how to store the details in a variable and send it as a output varaibale.------?for eg: i have three records...rec 1 : aaaarec 2 : bbbbrec 3 : ccccand the output value shld be aaaabbbbcccchow to do this.. please help meanwer |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2002-11-01 : 08:05:38
|
| I've never used cursors. Here's a set based method that should work.declare @allnames varchar (4000)set @allnames = ''SELECT @allnames = @allnames + tpmdetails FROM (SELECT Top 100 percent tpmdetails FROM topicmaster ORDER BY tpmtopicid) MySetPrint @allnames----------------------------Sam |
 |
|
|
|
|
|