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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Check string for number of errors
 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  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000