question

Mahesh120718 avatar image
Mahesh120718 asked

Nvarchar(max) getting truncated

Create table #abc(id int identity(1,1), val int default 2)
Insert into #abc default values
Go 1000000
Select stuff((select ','+cast(id as nvarchar(max))+cast('-' as nvarchar(max))+cast(val as nvarchar(max)) from #abc for xml path('')),1,1,'')

Output Value getting truncated

Please help me

nvarchartruncated
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kev Riley avatar image
Kev Riley answered

When you say truncated, how are you seeing this?

If you are looking at this in SSMS, maybe you haven't set the output large enough?

Look at:

  • Tools > Options > Query Results > SQL Server > Results to Grid > XML Data
  • Tools > Options > Query Results > SQL Server > Results to Grid > Non-XML Data
  • Tools > Options > Query Results > SQL Server > Results to Text > Maximum number of characters displayed in each column
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mahesh120718 avatar image Mahesh120718 commented ·
,

Hi, i am seeing in results as text mode using for xml path

0 Likes 0 ·
Mahesh120718 avatar image Mahesh120718 commented ·

Hi.. thanks issue got resolved..

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.