I've got a column called description of type NVARCHAR(MAX) - biggest you can have. I need to return this field with quotes around it, so I'm trying to
SELECT QUOTENAME(description, '"')
This doesn't work - I get a "string or binary data would be truncated error."
My googling tells me that this problem can be solved by using SET ANSI_WARNINGS OFF, but if I do that, I still get the same error anyway.
Normally I would just pull the values into a temp table and use a field that is two characters bigger than the field I'm pulling in, thus ensuring that the QUOTENAME function won't cause any problems. How do I make a column two characters bigger than MAX, though?
QUOTENAME is a function intended for working with strings containing SQL Server identifier names and thus only works for strings less than or equal to the length of sysname (128 characters).
Why doesn't SELECT '"' + description +'"' work for you?
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