I have a column (col1) with nvarchar(max).
I am trying to do
DECLARE @my_string NVARCHAR(max)
set @my_string = N'test'
UPDATE dbo.tab1
SET col1 = @my_string + ISNULL(col1, N'')
no luck , I have no idea why it is happening. @marc_s
The string value in col1 getting truncated after 250 characters. This happening in both SQL Server 2005 and 2008.
First of all – I’m not seeing this behavior you’re reporting. How and why do you think your column gets truncated at 250 characters?? Are you using a tool to inspect the data that might be truncating the output??
You could check the length of the column:
Is it really only 250 characters long???
Also: you’re mixing
VARCHAR(in@my_string) andNVARCHAR(col1) which can lead to messy results. Avoid this!Next: if you want
NVARCHAR(MAX), you need to cast your other strings to that format.Try this:
As I said – in my tests, I didn’t need to do this – but maybe it works in your case?