[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

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?
0
jwa082276
Asked:
jwa082276
1 Solution
 
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
 
jwa082276Author 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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now