Link to home
Start Free TrialLog in
Avatar of wingkchan
wingkchan

asked on

Avoid SQL Job failure when warnings are encountered

Hello,

I have a question about setting "allow warning" (I don't know how to call it) within the SQL jobs, and wondered if anyone can help.  I am monitioring an SQL 2000 Server, and within it, it contains a few SQL Jobs.  The jobs have been running fine all these times, but then one of them started to failed the last couple days.

The step that failed is in the middle of the job.  I tried to run that particular step in Query Analyzer, and it completed with an warning.  but if the job is auto-run in SQL Enterprise Manager, then it would fail.  I think I have heard (or read) somewhere that we can skip the non-so-critical messages, so the job would continue on without failing, but I couldn't recall what that is or where I can find that option.   Does anyone know what is that call, or where should I look for that information?  

Thanks in advance!
Avatar of Cvijo123
Cvijo123
Flag of Croatia image

In SQL Server Enterprise Manager inside your server go to Management then SQL Server Agetn then alerts

There are alerts that can break your job step at some point, i dont know what your job is doing and what of those alerts can be changed to let your job pass.

u can replace that alert with your own are make severity less so it doesnt stop the job
I know i have simular problems with my replication and when i changed those alerts (alert wasnt important at all) it worked nicely.

If u need more info i can give u some more details when i can get to server when I did that.
Avatar of nmcdermaid
nmcdermaid

You just change the job step so that if it fails it goes to the next step (rather than completing the job with failure)
Avatar of wingkchan

ASKER

Cvijo123:  Thanks for the information.  However, I am not too sure as how to use it.  Once I set a new alert with a severity identifier, in the "Response" page, it doesn't seems to offer any option to "Ignore" that warning and tell SQL to go on with the job.  Do you know how to set the "Allow warning and keep on going" rule?

Nmcdermaid:  thanks the infomation as well... but I am not the DB admin and I don't want to change the job integrity check... I will confirm with him about that possible option.  Thanks for this alternative idea!
Is your job part of replication mybe ?

Now when i check on my server i remember i went on Distribution Agent Profiles where i could change behaviour what error to skip (used Continue on data consistency errors. in skip error list i edit error i got with my job's)

To check error u got go to your job and use job history to see error's (check See step details) and your error and what cousing him to stop jour job steps should be there.
(U can see those errors on that machine server in Event Viewer under Administrative tools in your Control Panel. Use Application tree in viewr and u can use filter to show only MSSQLSERVER source and everything except information)

Past those errors if u can so we can work around so your job execute normaly.
Thanks for the quick response Cvijo123.  

The SQL job has to do with organizing data in different tables, and then updating another table, so it is somewhat different than your replication job, and I can't relate my case with your Distribution Agent Profile step.

The error message under Job Detail shows:
 String or binary data would be truncated. [SQLSTATE 22001] (Error 8152)  The statement has been terminated. [SQLSTATE 01000] (Error 3621).  The step failed.
It might have happenend when the updating occurred
ASKER CERTIFIED SOLUTION
Avatar of Cvijo123
Cvijo123
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw i just recalled u can do  something like this in your SP

SET ANSI_WARNINGS OFF

and it will eliminate those errors but i again suggest u fix your SP to work properly.
Hi Cvijo123, I confirmed with the system developers and they said that it should be the data field not accepting long values just like you said.  It could have been that there are other jobs that uses the same tables, and that caused the errors in this SQL job.The case has been passed to them, and they will fix up the problems.  Thank you very much for helpful assistance.

And yes, I agree with you that it should be fix to the root instead of just skipping over the problem... But sad to say that I am not strong with SQL...and this is another good lesson to learn something that I don't know.  Thank you.