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-11 : 02:09:30
|
| Hi,I have to store more than 8000 data in a variable... and the below code is working perfectly but it is storing upto 8000 only, plz suggest me how to store more than 8000 data.I used Text data type but it is not allowing me to do that.. what is the alternate?---------------------declare @allnames varchar(8000)set @allnames = '' SELECT @allnames = @allnames + tpmdetailsFROM (SELECT Top 10 tpmdetailsFROM topicmaster Where tpmtopicid = 'TM00000038' or (tpmowner = 'TM00000038' and tpmname like '%Cont...')order by tpmtopicid) MySet Print @allnames -------------------regardsMd Anwer Ali |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-11-11 : 04:46:07
|
| You could use 2 8000 char variables and put the top 5 in one and the next 5 in the next but that would just give you a max of 8000 per 5 items.Do you need to return this in a single variable? Can you return a result set instead?If not consider a temp table with a text field and a loop to get the data.You should also be able to do it with dynamic sql building the statement depending on the size of the items or an if statement to decide whether to use a string or text depending on the size.==========================================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. |
 |
|
|
|
|
|