SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Check string for number of errors
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 02/03/2012 :  17:01:53  Show Profile  Reply with Quote
Hi Folks

I hope you can help me out here. I'm working with a database where a particular table has a char(80) column called 'Details' which is used to report whether a process produced an error.

The output can look some like this.

Processing of task A complete.
Processing of task B complete.
Checks complete. Processed: 150. Errors 0.
Processing of task C complete.
Processing of task D complete.
Checks complete. Processed: 52. Errors 13.

Is it possible to do something if the column 'Details' contains Errors > 0 like set an variable to true or something?

I'm not too sure on where to start with conditional checks with a string and a wildcard so your help would be truly appreciated.


Starting Member

2 Posts

Posted - 02/03/2012 :  17:25:15  Show Profile  Reply with Quote
Figured it out.

I put the output of a select query into a variable and then done this...

IF @result NOT LIKE '%Errors 0%'
PRINT @result
PRINT 'Errors Found'
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000