I have a SQL Stored procedure that sends a mail. It's signature looks like this:
CREATE PROCEDURE SendMail
@From varchar(40),
@To varchar(255),
@Subject varchar(255),
@Body varchar(max),
@CC varchar(255) = null,
@BCC varchar(255) = null
AS...
When the message is for example 5000 characters it work. When it is 12 000, I get an error that [ODBC SQL Server Driver]String data, right truncation.
According to the help files varchar(max) can handle 2^31-1 bytes / characters.
So I tried changing @Body varchar(max)
to @Body varchar(30000)
and I get an error that
The size (30000) given to the type 'varchar' exceeds the maximum allowed for any data type (8000).
So the max is 8000 and not 2^31-1 bytes? How can I handle more than 8000 characters?