Monday, March 12, 2012

job fails when run with sqlagent.

I have a storeded procedure 'refresh_all' that denormalizes some tables for
easier reporting. I can run it fine from isqlw command window, but when I
put it into a job it consistently fails.
I'm probably over looking something really basic.
Here is the error from the single step
Executed as user: son\kevinrug. String or binary data would be truncated.
[SQLSTATE 22001] (Error 8152) The statement has been terminated. [S
QLSTATE
01000] (Error 3621). The step failed.
At first I thought it was the user account, but I verified the it has
permissions in the database and on the procedure. Beside, I am system admin
and dbo so that shouldn't have been a problem.
Also, I am starting the service (sqlagent) under my network account.
Help greatly appreciated.
kevin>> ... String or binary data would be truncated.
The error message suggests it has to do with the data in the tables
involved. Check your processes for datatype conversions, lengthy character
data inserted into tables with types of shorter length, mismatched sql
operations like joins on columns with incompatible types etc.
Anith|||ok I'll look at that. I was wondering if this is what it meant, but since it
ran ok interactively I wasn't sure.
Also, will try running each sub-proc to see which is failing.
"Anith Sen" <anith@.bizdatasolutions.com> wrote in message
news:eoJP1GJEFHA.612@.TK2MSFTNGP15.phx.gbl...
> The error message suggests it has to do with the data in the tables
> involved. Check your processes for datatype conversions, lengthy character
> data inserted into tables with types of shorter length, mismatched sql
> operations like joins on columns with incompatible types etc.
> --
> Anith
>|||Thanks again.
After investigating, I found I had turned ansi_warnings OFF, once I put this
in the procedure it runs great.
kevin
"Anith Sen" <anith@.bizdatasolutions.com> wrote in message
news:eoJP1GJEFHA.612@.TK2MSFTNGP15.phx.gbl...
> The error message suggests it has to do with the data in the tables
> involved. Check your processes for datatype conversions, lengthy character
> data inserted into tables with types of shorter length, mismatched sql
> operations like joins on columns with incompatible types etc.
> --
> Anith
>

No comments:

Post a Comment