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 |
|
iswan
Starting Member
28 Posts |
Posted - 2007-06-08 : 07:25:33
|
| Is it possible to convert single column value to string? (with out using cursor or while loop) i.e Is Any Aggregate function available?I have seen SettoStr() function. But It is not working in SQL server 2000.Ex:create procasdeclare @FieldNam varchar(1024)select @FieldNam=Name from ProjectPRINT @FieldNamendselect statement return multiple row output. But I am only getting first value in PRINT. I know If I use cursor or while loop can construct the string. But I want to know any other way with out thisComing Output: ProjectOneNeeded Output: ProjectOne,ProjectTwo,PRojectThree..RegardsIswan |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-08 : 07:30:24
|
| [code]Select @FieldNam = Coalesce(@FieldNam + ',','') + Name from ProjectPrint @FieldNam[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
iswan
Starting Member
28 Posts |
Posted - 2007-06-08 : 07:38:06
|
| Thank you very much Harsh Athalye |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-09 : 07:44:58
|
| Also note that if the concatenated string exceeds 8000 characters, you need to use more than one variableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|