How do I fix this error?
The text, ntext, and image data types are invalid for local variables.
My proc is:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[GetJobInfo] ( @jobId int, @subject varchar(50) OUTPUT, @Body ntext OUTPUT, @prepared_email_id int OUTPUT ) AS BEGIN SET NOCOUNT ON SELECT TOP 1 @prepared_email_id = p.[PreparedEmailID], @subject = p.[Subject], @Body = p.[Body] FROM [PreparedEmails] p INNER JOIN [Jobs] j ON p.[PreparedEmailID] = j.[PreparedEmailID] WHERE j.[JobID] = @jobId RETURN END
I don't know what the error is or how I fix it. Please help me...
NTEXT is a variable-length data type that can store long Unicode character strings. NTEXT can hold up to 2,147,483,647 bytes of data. The actual storage used depends on the length of the character string.
ntext will always store its data in a separate database page, while nvarchar(max) will try to store the data within the database record itself. So nvarchar(max) is somewhat faster (if you have text that is smaller as 8 kB). I also noticed that the database size will grow slightly slower, this is also good.
Text - Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters. nText - Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters.
The ISO synonym for ntext is national text. Variable-length non-Unicode data in the code page of the server and with a maximum string length of 2^31-1 (2,147,483,647). When the server code page uses double-byte characters, the storage is still 2,147,483,647 bytes.
It's telling you that you are not allowed to use NTEXT as a data type for local variables.
Changing @Body ntext OUTPUT
to @Body NVARCHAR(MAX) OUTPUT
will get it working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With