May 3, 2006 at 8:14 am
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?
May 3, 2006 at 1:09 pm
This is a case where dynamic sql is the only way......do a remote execute statement.....
Execute Otherdatabase.dbo.sp_execute "Drop ....."
May 4, 2006 at 8:42 am
Or...
Exec('Use targetdbname Drop Table tablename')
May 4, 2006 at 9:04 am
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