0

In SQL Server ,One of my table has a text column named description and it contains the value in one particular row as

"addText : PCS 10.17.16.5 is activated notificationId : 429 probableCause : TransmitFailure(54) severity : severe(3) " 

From the mentioned Text I need to fetch the value for the each key seperately and display the result in a seperate column .

I used the below SQL Query but it is not working !

SELECT  SPLIT(description,"_") FROM [dbo].[Stg_Event]
# (or)
SELECT  Split(description,':') FROM [dbo].[Stg_Event]

please help..Thanks in Advance

Zahori
  • 446
  • 1
  • 4
  • 16
  • which values do you want to fetch? Col1: PCS... Col2: 429 probableClause ...? – stylefish May 29 '18 at 07:34
  • Check the duplicate link. If it doesn't meet your needs then leave a comment here why this is the case. – Tim Biegeleisen May 29 '18 at 07:38
  • please give me an example – Hasan Fathi May 29 '18 at 07:38
  • Give example of result – Killer Queen May 29 '18 at 07:40
  • @TimBiegeleisen is there anyway we can remove the accepted answer from that post? – WhatsThePoint May 29 '18 at 08:14
  • @WhatsThePoint No, but if you strongly disagree you may choose to downvote it, or maybe add a comment. – Tim Biegeleisen May 29 '18 at 08:30
  • I don't like the most upvoted answer either, a `WHILE` loop is an awful way to split a string in SQL Server. Using the XML replacement is a far better way. personally, I think we need to stop using that Question as the duplicate, it's a bad example. – Thom A May 29 '18 at 08:45
  • Thank ! I need the Output from the Description Column addText : PCS 10.17.16.5 is activated notificationId : 429 probableCause : TransmitFailure(54) severity : severe(3)" Here all are in the same row but I need all the values alone to be displayed in a seperate column like mentioned below. OutPut: Column1 Column2 Column3 Column4 – Haritha Saravanan Jun 04 '18 at 05:56
  • Thanks stylefish ! I need the Output from the Description Column addText : PCS 10.17.16.5 is activated notificationId : 429 probableCause : TransmitFailure(54) severity : severe(3)" Here all are in the same row but I need all the values alone to be displayed in a seperate column like mentioned below. OutPut:I will Explain the result for 2 values alone from the mentioned Description Column. PCS 10.17.16.5 is activated as column1 , 429 as column 2 , TransmitFailure(54) as column 3 – Haritha Saravanan Jun 04 '18 at 06:05

0 Answers0