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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 procedure returning more than 8000 chars

Author  Topic 

mdanwerali
Starting Member

30 Posts

Posted - 2002-11-13 : 04:12:16
Hi,

I have a set of records and in the procedure i am concatenating all the records and storing in a variable. But i am getting problem when my storing values are more than 8000. Becuase varchar will support only 8000 chars...

Can any one suggest me how to return more than 8000 chars in a single variable. For example this code i have written in sql editor and the code is not working for Creating a New Function.

Suggest me the alternate...
----
declare @allnames varchar(8000)
set @allnames = ''
SELECT @allnames = @allnames + tpmdetails
FROM
(SELECT Top 10 tpmdetails
FROM topicmaster
Where tpmtopicid = 'TM00000038'
or (tpmowner = 'TM00000038' and tpmname like '%Cont...')
order by tpmtopicid) MySet
Print @allnames


----

Thanks in Advance


Anwer


mr_mist
Grunnio

1870 Posts

Posted - 2002-11-13 : 04:22:36
I can't answer your original question (except to say use text instead) but you could, instead of storing everything in one big field, simply have a table that contains varchar(8000) fields and a sequence number for each entry, then any entry could have as many (or as few) sets of 8000 as it needed. This would work best, I think, if most of the entries fall below the 8000 limit.

TABLE: entries
entry_id : some kind of id / foreign key linking back to the entries table
entry_text : varchar (8000)
entry_sequence : tells you what order to glue back the entry_text for this entry together in.

You'd then just need to get your front end app to pass in the entries split up into chunks 8000 characters or less.

Go to Top of Page
   

- Advertisement -