March 12, 2019 at 7:39 am
I have a table that can have numerous rows that contain notes these are set as nvarchar(80) and the problem that I am running into is that the cut off of the column being at 80 characters it will split words. When using the below statement it works as expected but cuts off the first letter , if i change the (select STUFF((SELECT ' ') to include a space ' ' it inserts an unwanted space after the 80 character causing some words to have a space but returns the full string as needed. Trying to determine best way to solve this.
,(select STUFF((SELECT ' ' + crd.crmnote0 FROM test.dbo.crmdetl as crd WHERE crd.callnum = crm.callnum
ORDER BY crd.crmdet0 ASC FOR XML PATH(''), type).value('.', 'nvarchar(max)'),1,1,' ')) AS 'CallNotes'
March 12, 2019 at 10:28 am
The purpose of the STUFF() is to remove the very first delimiter when creating delimited strings. You're not delimiting your strings, so you do not need the STUFF().
If that doesn't solve your problem, please post sample data and expected results.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply