100+ |
Try this: Solution 1(Using XQuery Approach) - DECLARE @xml as xml,@str as varchar(100),@delimiter as varchar(10)
-
DECLARE @tblDestination(SplittedRecords varchar(100))
-
-
-
-
SET @str = '25 123454756741 $GPRMC,093729.000,A,1301.7595,N,08015.2751,E,1.13, 69.84,080210,,*3E,BAUTO 0 3/9/2010 3:07:29 PM'
-
SET @delimiter =','
-
SET @xml = cast(('<X>'+replace(@str,@delimiter ,'</X><X>')+'</X>') as xml)
-
INSERT INTO @tblDestination
-
SELECT N.value('.', 'varchar(10)') as value FROM @xml.nodes('X') as T(N)
OUTPUT - 25 123454756741 $GPRMC
-
093729.000
-
A
-
1301.7595
-
N
-
08015.2751
-
E
-
1.13
-
69.84
-
080210
-
-
*3E
-
BAUTO 0 3/9/2010 3:07:29 PM
Hope this helps
| |