Thursday, June 26, 2014

Reading String (Name-Value) from text file into XML

Hi,


I have a requirement for reading a text file and converting each entry of that text file into XML format. I have not came across such thing yet so looking for some ideas. I am using SQL Server 2005 and here is a sample entry from my source text file,


Jun 4 14:31:00 zzzz64x02 fff:


INPUT(ty=XYZ,Prefix=15063,dn=78787878787878,sgk=100.139.201.48,xxn=87878,ani=656565656565,ogrp=F7ZX05,ogtxt=NNNNN,ogx=NNNNN,oci=0xe00ac,ogi={NOA=INT,BC=1,SIG-TYPE=ZIP});


PROCESS(ty=0x100000,cu=32880,Name=XOXOXOX,pc=88017,pd=24,dd=880175,pk=880175,rd=115472,ca=BGD,reg=RW,cdp=1,ai=245359,grp=2648,sl=9);


OUTPUT(ty=XXXX,ret=0,rl=


{i=1,su=99999,rizID=61084,skid=06,truckgp=1084,dd=8801,dn=78787878787878}



I will get multiple entries like this in my source text file which I have to convert into XML (using TSQL).



Any help will be useful.



Regards.




'In Persuit of Happiness' and ..... learning SQL.


No comments:

Post a Comment