I have 3 columns in my table X:
Id State Type 1 NJ Form1 1 NY Form 2 1 TX Form 3
I want to consolidate it to one column in table Y:
Id FormTypes
1 NJ:Form1
NY:Form2
TX: Form3
Is this possible to achieve???
Currently I have worked out so much:
DECLARE @NewLine as char(2) = char(13) + char (10)
UPDATE tableY
SET FormTypes =
(
select substring(
(select ':'+ [State] + ':'+ Type+ @NewLine AS 'data()'
from tableX
for xml path(''))
,3, 255)
as "MyList" )
This is giving me garbage like this:
NJ:Form1'
'; NY:Form2'
'; TX:Form3'
';
The reason for getting it in this form is due to the way it is getting read in multiple files.
this will give you tableY form