Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 handling data errors

Author  Topic 

David2455
Starting Member

6 Posts

Posted - 2011-05-01 : 14:20:54
Hi all

I am pretty new to sql and working with a set of time data that includes errors (which were not controlled in the input process) and I cannot go back and correct the database history. So, for example I encounter a time in my table as 25:00:00 and my sql query throws an error and stops.

Is there a way of continuing on with the query and identifying a specific cell error in the table as "error" or something like that?

Alterntively I could try and filter in my staging table (if I knew how!) as the errors appear to be either (a) a time that's greater than 23:59:59, or (b) a time that is simple a 2 digit number (such as say 16).

Any help would be much appreciated.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-01 : 14:29:38
Filter them out.

where time >= '24:00:00' -- you don't need the full text but will be easier to understand.
or len(time) < 8

You can use that to include rows that are vaid or to delete rows that are invalid.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

David2455
Starting Member

6 Posts

Posted - 2011-05-03 : 02:46:41
Thanks for the suggestion, I have implemented the filters and the import is now working ok! Thanks again!
Go to Top of Page
   

- Advertisement -