SQL 2005: Why does DECLARE varchar(MAX) in Stored Procedure not work?
I have a Stored Procedure with
DECLARE myString varchar(MAX)
Now when I set a text which is bigger than 8000 Bytes, it gets cut.
Why? I thougt SQL 2005 has now varchar(max)?
Thanks for any help!
> Now when I set a text which is bigger than 8000 Bytes, it gets cut.Where does it get cut? Are you using PRINT, SELECT, passing the parameter
to another stored procedure, inserting into a table, ...???
How did you verify whether a truncation occurred? What is the compatibility
Works for me
can you run this example
create procedure TestVarcharMax
declare @v varchar(max)
select @v = (replicate (cast('a' as varchar(max)), 9000))
exec TesTVarcharMax @v
I get back 9000
Denis the SQL Menace
(1 row(s) affected)
Andreas Klemt wrote:
Show quoteHide quote
> I have a Stored Procedure with
> DECLARE myString varchar(MAX)
> Now when I set a text which is bigger than 8000 Bytes, it gets cut.
> Why? I thougt SQL 2005 has now varchar(max)?
> Thanks for any help!
> Andreas Klemt
Other interesting topics
How to concatenate strings from a column into a single row (with NULL value)?
Single to Multiple columns
Assistance with SQL Script
HOW TO: PIVOT for unknown number of column headings?
Best way to document databases ?
Programmatic package execution - SQL Server 2005
where datetime between 2PM and 3PM
Database Performance query