n1coltsfan
Starting Member
2 Posts |
Posted - 2008-04-25 : 14:36:32
|
1 or 2 lines per every 600 is stepped on data its un unavoidable buffering issue with the device dumping the data. I don't want that data if I do this process manually I delete it. I am just hoping to come up with a stored proc or something that cleans the data for my queries and reports. I want the first row text, second row number and third row number in the finished deal. Small sample of raw data + sign is my delimiter,"UVN+ 690.0000+ 0.0000""UVN+ 691.0000+ 5.0000""UVN+ 692.0000+ 0.0000""UVN+ 693.0000+ 5.4500""UVN+ 694.0000+ 0.0000""UVN+ 695.0000+ 0.0000""UVN+ 696.0000+ 0.0000""UVN+ 697.0000+ 0.0000""UVN+ 698.0000+ 0.0000""TLOV+2001.0000+ 0.0000""TLOV+2002.0000+ 94.9660""TLOV+2003.0000+ 0.0000""TLOV+2004.0000+ 233.2690"Here is the code I am using below is the result it works if row 2 & 3 are numbers or null but not if junk data which is unavoidable, SELECT raw_payload, LEFT(raw_payload+'+++', CHARINDEX('+', raw_payload+'+++', 1)-1), CAST(--NULLIF( SUBSTRING(raw_payload+'+++', CHARINDEX('+', raw_payload+'+++', 1) + 1, CHARINDEX('+', raw_payload+'+++', CHARINDEX('+', raw_payload, 1) +1) - (CHARINDEX('+', raw_payload+'+++', 1) + 1)) --,'') AS FLOAT), CAST(--NULLIF( REPLACE( SUBSTRING(raw_payload+'+++', CHARINDEX('+', raw_payload+'+++', CHARINDEX('+', raw_payload+'+++', 1) +1) + 1, LEN(raw_payload) - CHARINDEX('+', raw_payload, CHARINDEX('+', raw_payload+'+++', 1) +1) + 1) ,'+','') --,'') AS FLOAT)FROM raw_dataRESULT:Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to float. |
|