Thursday, March 8, 2012

Alter Database statement

Is it possible to issue an alter database statement across servers?
For example
Alter Database Server.Database
Also, the same question with dbcc shrinkdatabase.
Can you do dbcc shrinkdatabase('Server.Database')?
Thanks
Not directly. But if the linked server is configured so that you can execute remote stored
procedures, you can do:
EXEC Server.master.dbo.sp_executesql('ALTER DATABASE dbname...')
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Andy" <Andy@.discussions.microsoft.com> wrote in message
news:73D8641F-7DED-48CA-80C9-762AC78D20C2@.microsoft.com...
> Is it possible to issue an alter database statement across servers?
> For example
> Alter Database Server.Database
> Also, the same question with dbcc shrinkdatabase.
> Can you do dbcc shrinkdatabase('Server.Database')?
> Thanks

No comments:

Post a Comment