sql server - SQL 'stuff' and 'FOR XML PATH' generating strange symbols -


i have following query inside larger select statement in sql server:

 convert(nvarchar(2000),stuff((select '; ' + isnull(d2.selectedcomments,'')  #studentdetails d2  d2.stud_pk = a.stud_pk , d2.courseno = a.courseno , d2.section = a.section xml path('')),1,2,'')) selectedcomments, 

this column generating strange symbols after entries such this approach satisfactory .&#x0d. don't understand .&#x0d coming from. tried doing select selectedcomments #studentdetails right before , don't see .&#x0d. can tell coming from?

if modify use of xml path, unescaping , won't need resort using replace function:

,   stuff(         (         select '; ' + isnull( d2.selectedcomments, '' )         #studentdetails d2         d2.stud_pk = a.stud_pk             , d2.courseno = a.courseno             , d2.section = a.section         xml path(''), type         ).value('.', 'nvarchar(max)')         , 1, 2, '') selectedcomments 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -