Jeff Moden (3/24/2014)
If the content of the column is less than 128 characters, the you could also do the following...
SELECT QUOTENAME(Column1,'''') AS quotedColumn1
FROM TableA;
if its more then 128 characters, then you need a UDF something like this
declare @x nvarchar(max), @y nvarchar(max), @z nvarchar(max), @QT nchar(1);
set @QT = '"';
set @x = replicate('XYZ'+@qt,33);
set @y = quotename(@x,@qt);
set @z = @QT+replace(@x,@qt,@qt+@qt)+@qt;
select @x as '@x', len(@x) as 'len(@x)';
select @y as '@y', len(@y) as 'len(@y)';
select @z as '@z', len(@z) as 'len(@z)';