Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Search for columnName and Split data based on that column name

$
0
0

Hi All,

I have a table with one column, lets say Notes of datatype varchar(max).

Source Date:

Notes

ABC:123:XYZ Dept:IT NameID:1 Name:Tom Hummer Date:04/12/2004
456789:CDEF:ADEF
CBD:12/12/2000:ZXCV Dept:HR NameID:1 Name:Sam Dope Date:06/17/2005

I want Output should look like below. It should split data at 'Dept:' and 'Name:' I need SQl code  for SQL Server 2008 R2

Output:

Notes

Dept:IT Name:Tom Hummer
Dept:HR Name:Sam Dope

Thanks,
RH


sql


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>