June 6, 2012 at 2:01 pm
When I use QUOTENAME with varchar(max), it is giving me error
DECLARE @test-2 VARCHAR(MAX),
@String VARCHAR(MAX)
SELECT @test-2 = '',
@String = '1234567890'
;WITH
cteTally AS
(--==== Create a Tally CTE from 1 to 10,000
SELECT TOP (10000)
ROW_NUMBER() OVER (ORDER BY t1.ID) AS N
FROM Master.sys.SysColumns t1
CROSS JOIN Master.sys.SysColumns t2
)
SELECT @test-2 = @test-2 + '1234567890'
FROM cteTally
SET @test-2= QUOTENAME(@Test,'''')
SELECT LEN(@Test)
June 6, 2012 at 2:06 pm
Boooks online says a the argument expects a varchar/nvarchar(128) for the max size.
QUOTENAME ( 'character_string' [ , 'quote_character' ] )
Arguments
'character_string'
Is a string of Unicode character data. character_string is sysname and is limited to 128 characters. Inputs greater than 128 characters return NULL.
'quote_character'
Is a one-character string to use as the delimiter. Can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.
Return Types
nvarchar(258)
Examples
Lowell
June 6, 2012 at 2:37 pm
Thank you very much. I just jumped without checking book online.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply