Drop procedure from other DB

  • Hello.

    I have a procedure to programatically restore a DB (datawarehousing), but I'm stuck...

    I have to drop a stored procedure from the restored database, but USE statements are not allowed in SPs, so I tryed db.owner.spname naming, but explicit DB naming is not allowed for DROP PROCEDURE statements.

    How can I get rid of that procedure?

  • This is a case where dynamic sql is the only way......do a remote execute statement.....

    Execute Otherdatabase.dbo.sp_execute "Drop ....."

     

  • Or...

    Exec('Use targetdbname Drop Table tablename')



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • Great!

    Thanks for your help, it worked.

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

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