SQL 2005 - JOB FAILURE

  • A weekly job(DTS) contains the below code; For the past 3 weeks it has failed due to various reasons.

    1st week: Deadlock (so rescheduled to run at other time)

    2st week: Error string: Cannot drop the table 'dbo.TABLE_NAME', because it does not exist or you do not have permission

    3rd week: Error string: There is already an object named 'TABLE_NAME' in the database

    -- drop table if exists

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TABLE_NAME]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[TABLE_NAME]

    --GO

    -- create temporary persons table

    create table TABLE_NAME

    (

    ....

    ....

    )

    --GO

    Any ideas why this is happening and also to resolve it.

  • At a guess, from the logs.

    2nd week: you tried to drop a table that you don't have permission to.

    3rd week: table already exists so you can't create it

  • But the code has "drop table" part which should delete the table and create it as a new one. It was running previously without any issues. Also it runs under sa

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

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