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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-05-09 : 08:39:53
|
| Ashish writes "Hi,I want to return a string of words separated by comma using coalesce() so that the client application can look for a specific word in this long string.Following is the script:-CREATE TABLE WordList(WordId int IDENTITY,WordDesc varchar(100))INSERT INTO WordList VALUES ('Lion')INSERT INTO WordList VALUES ('Goat')INSERT INTO WordList VALUES ('Snake')DECLARE @WordList varchar(8000)SELECT @WordList = COALESCE(@WordList + ', ', '') + WordDescFROM WordListSELECT @WordList AS WordListAbove approach works fine.However,as the maximum size for varchar is 8000,any longer string will be truncated.I can not use "text" datatype for this as it is not allowed.Any workaround?Any pointers?" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-05-09 : 10:13:08
|
| Why not get the app t send the word and look for it in the SP.Maybe use varchar(max) if you are v2005?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|