Hi All,
I have a table with 2 columns ID as Int and Message as nvarchar(max)
Create table Sample
(
ID int not null,
Message nvarchar(max) null,
CONSTRAINT [PK_ID_Msg] PRIMARY KEY CLUSTERED
(
ID asc
)
)
Insert statement:
INSERT INTO
Sample (ID, Message)
VALUES (1, 'X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
')
INSERT INTO Sample (ID, Message) VALUES (2, 'X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017
; Z: 1
; Z_DATE: 06/02/2012')
Data in the table looks like:
ID Message
1 X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
2 X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017 ; Z: 1 ; Z_DATE: 06/02/2012
Need out put as below, just with numeric data:
ID X-Column Y-Column
1 00 18 000 00 16 011
2 01 15 010 00 18 017
So, please I need t-SQL to get above output.
Thanks in advance.
RH
sql