What is the equivalent of SQL Server's
varchar(max) data type in ASE?
By ASE I mean what used to be known as Sybase ASE, which is now owned by SAP.
I'm attempting to execute a piece of dynamically constructed T-SQL that is longer than 8,000 chars.
If I declare a variable with
varchar(max), ASE chokes with:
Incorrect syntax near the keyword 'max'.
My next thought was to try the
text datatype. But alas:
You specified an incorrect datatype for the variable containing the 'execute immediate' command string.
A minimal, complete, and verifiable example:
DECLARE @cmd varchar(max) --change this to varchar(4000) and it works SET @cmd = 'SELECT 1;' EXEC (@cmd); GO
Changing the variable declaration to
text or whatever will suit your purposes. I need to execute a dynamic command that is probably 50,000 characters long.
Alternately, I could use a cursor, but I am unfamiliar with how cursors work on ASE.
Note that in SQL Anywhere, you can define an equivalent to the varchar(max) datatype as
declare @cmd long varchar;, however that won't work in ASE.