Translate

Wednesday, 28 June 2017

sql :Assign comma in sql column , sql xml path


Syntax
STUFF(string, start, length, new_string)



SELECT STUFF('01234567', 'ketenumber position', 'keteta', 'replace value');
SELECT STUFF('01234567', 4, 2, ''); ---result 012567
ie 34 is gone
3 is at 4 position




select ','+ Roll_No from Candidate where Dist_code='02' for XML path('')

result : ,1,2,3,4,5,6,7



select stuff(
(
    select ','+ Roll_No from Candidate where Dist_code='02' for XML path('')
),1,1,'')


result : 1,2,3,4,5,6,7






No comments:

Post a Comment