DROP DATABASE FROM REMOTE SERVER

can a drop database statement be issued against a database that is on a server that is setup via a linked server?
jwa082276Asked:
Who is Participating?
 
jwa082276Connect With a Mentor Author Commented:
I figured it out...

you can do something like this:
set @str = 'EXEC servernamemaster..sp_executesql N' + char(39)+'drop database databasename+char(39)
exec(@str)
0
 
momi_sabagCommented:
i'm not sure,
but if it can't be done,
you can write a procedure that receives a database name as a parameter and drops it
you can invoke stored procedures through linked server so this will solve your problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.