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)
 SP: How to store very big string to a local string variable

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-04-12 : 09:10:44
Jayganesh S writes "Hi there,
I want to store a huge size of string value to a local variable of type "varchar" in a Stored Procedure.

Microsoft Ms-SQL Server 2005 supports upto 8KB of string value can be stored to a local string variable by declaring like "DECLARE @strTemp VARCHAR(Max)".

But I need to store more than that. Please help anybody who is having any idea to work around this problem.

Thank you very much!

Jayganesh Sambath"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-04-12 : 09:12:52
Varchar(max) can hold more than 8,000 characters:

declare @strTemp varchar(max)
set @strTemp=replicate('abc', 8000)
set @strTemp=@strTemp+@strTemp
select len(@strTemp)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-12 : 11:44:44
8,000 characters was the limit for varchar in SQL 2000 - maybe that is the source of your confusion?

Kristen
Go to Top of Page
   

- Advertisement -