sql server 2005 SP2 / Sp3

  • I have a SQL Job that I run on SQL Server 2005 SP2 that fails with the following error:

    Executed as user: Invalid length parameter passed to the SUBSTRING function. [SQLSTATE 42000] (Error 536) The statement has been terminated. [SQLSTATE 01000] (Error 3621). NOTE: The step was retried the requested number of times (1) without succeeding. The step failed.

    When I copied the stored procedure over to a different server same database, However the Server is on SQL2005 SP3. The Process runs with no issues??

    Anyone know what would cause this to happen? Is this a problem with the SP?

  • That's a data issue. something is calculating a parameter for substring (liekly) and passing in something like a 0 for a parameter that doesn't accept it.

  • YES you are correct it's a data issue. I took a more recent backup and got the same error on my test server. Guess I was not thinking that clear when i posted this.

  • LOL, the only reason I know this is because it's happened to me 🙂

    Always be sure that you check data in SQL Server when examining code. It can introduce strange bugs that you might not expect.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply