Showing posts with label avariable. Show all posts
Showing posts with label avariable. Show all posts

Monday, March 19, 2012

Maximum Possible Length

Hello,
Could someone please tell me what is the maximum possible length for a
variable? I am currently using varchar (8000). I need something
larger. I am constructing code and storing it in a variable and then
executing it.
exec(@.Code)
@.Code is just an insert statement. It explicitly lists all of the
columns for a particular table.
Thanks.
I have not tested in that scenario but you can use varchar(max).
Hope this helps,
Ben Nevarez
"Wing9897@.hotmail.com" wrote:

> Hello,
> Could someone please tell me what is the maximum possible length for a
> variable? I am currently using varchar (8000). I need something
> larger. I am constructing code and storing it in a variable and then
> executing it.
> exec(@.Code)
>
> @.Code is just an insert statement. It explicitly lists all of the
> columns for a particular table.
>
> Thanks.
>
|||In SQL Server 2005 you can declare @.Code as varchar(max). If SQL Server 2000
then you can construct the code in multiple variables and concatenate at
execution, like:
exec (@.Code1 + @.Code2 + @.Code3)
HTH,
Plamen Ratchev
http://www.SQLStudio.com
|||What version of sql server are you working on ?
Sincerely,
John K
Knowledgy Consulting, LLC
knowledgy.org
Atlanta's Business Intelligence and Data Warehouse Experts
<Wing9897@.hotmail.com> wrote in message
news:b2223f0c-5970-4cab-8910-5d6b2031d5fc@.s8g2000prg.googlegroups.com...
> Hello,
> Could someone please tell me what is the maximum possible length for a
> variable? I am currently using varchar (8000). I need something
> larger. I am constructing code and storing it in a variable and then
> executing it.
> exec(@.Code)
>
> @.Code is just an insert statement. It explicitly lists all of the
> columns for a particular table.
>
> Thanks.