Tuesday, February 14, 2012

catch error that stops query from processing

Is there anyway to catch and error that stops an query from processing?

what I am doing is sending emails with sp_send_dbmail and I am now getting an error saying my attachment is above my limit... I have tries putting the email in a SP to catch the error.. I have tried using try/catch but nothing...

all I want to do is if the attachment (which is the results of a query) is too big just send tan email stating it was too big so I can go check it manually.

Thanks for all the help... not sure if there is anything that can be done.

oh... SQL 2005 enterprise SP2 on Window 2003 SP2.

I presume that you are sending out some form of 'report' or query results.

Perhaps a more reliable and consistant approach would be to always drop the 'reports' into a common folder, and send out emails letting folks know that the report/data is ready to be picked. (Also helps to reduce the impact on the email system.)

|||

It is query results that I am trying to send... and it is only to myself. I am automating as much of my processes as possible. I guess it would be just as easy to have the results sent to file then email myself saying it was done with how many rows were effected...

Is there a way in 2005 to execute an sp with the results going to a file?

|||

William,

What i often will do is have the JOB step write the output to a file, and then in the step that sends the email, I attach the file to the email.

No comments:

Post a Comment