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
 Transact-SQL (2000)
 limitation of varchar

Author  Topic 

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2005-08-29 : 09:29:13
declare @sql varchar(8000)
Select @sql=COALESCE(@sql + ',', '') + EmpNameE from Employee
select @sql

see this query cannot go beyound 8000 but i need more ...
yeh dil mange more....

Kapil Arya

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-08-29 : 09:42:39
>>yeh dil mange more....
????

Can you save some space by using IDs instead of names?

One option is to "chunk" the call. ie: make as many calls as necessary in <8000 char chunks. Another option is to add as many parameters/variables as necessary to handle the largest load.

Without more details can't offer much more...

Be One with the Optimizer
TG
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-29 : 09:53:53
Limit the selection

Something like

declare @sql1 varchar(8000)
declare @sql2 varchar(8000)
Select @sql1=COALESCE(@sql1 + ',', '') + EmpNameE from Employee where EmpId between 1 and 100
Select @sql2=COALESCE(@sql2 + ',', '') + EmpNameE from Employee where EmpId between 101 and 200
select @sql1+','+@sql2

>>yeh dil mange more....

I think he needs more

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -