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 |
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-08-12 : 08:47:57
|
| Is it possible to get the columns values horizontally with a comma seperator like this1,2,3,4,5,6,7,8 INSTEAD OF1234567without a loop just throuh SELECT query8 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-12 : 08:51:09
|
| Declare @ValueList varchar(1000)SELECT @ValueList = COALESCE(@ValueList + ', ', '') + col1FROM MyTable select @ColumnListGo with the flow & have fun! Else fight the flow :) |
 |
|
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-08-12 : 09:02:39
|
| Spirit :) Thanks a lotDear if we have around one million or more records then there will be a problem with the varchar(8000) data type. Is there any other way to solve this issue, please tell me |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-08-12 : 09:07:20
|
| most basic question: what would you want a million items in a comma seperate list for? knowing that might deliver a better (faster/more futureproof) solution to your overall problem. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-12 : 09:07:57
|
| you could split them in chunks of 8000....FROM MyTable where id<8000...FROM MyTable where id between 8000 and 16000and then put select them...Go with the flow & have fun! Else fight the flow :) |
 |
|
|
|
|
|