I have table containing column Email
which is varchar(MAX)
and I am trying to update it using stored procedure. When the string length is greater than 8000 characters, I get this error
String or binary data would be truncated. The statement has been terminated.
Stored procedure:
ALTER PROCEDURE [dbo].[SaveData]
@Id BIGINT,
@Email varchar(max)
AS
BEGIN
SET NOCOUNT ON;
UPDATE tb_data
SET Email = @Email
WHERE Id = @Id
END
Please note that datatype for email is set to varchar(MAX)
Interesting thing is when I try to run the update query manually, it works!
I've done this several times but cannot figure out why it's not working in this case.