Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute DDL (create, alter) syntax through a linked server connection

Status
Not open for further replies.

dmooreora

Programmer
Oct 10, 2002
24
US

Hello group,

I know probably the first response to this message will be "Why would you want to do that?" But trust me, we have a good reason.

We are trying to create a distributed database system that will allow us to execute create table... and alter table... commands from a master server to a remote server in a different location. This will be performed by the application. My question is, I always thought that this could be possible. What is the syntax to do this?

Thanks!
Dmooreora
 
Hello Group,

This feature appears to be in SQL-Server 2005 Transact-SQL.
It is the pass-through feature. Here is how it would work:

Execute a pass-through command against a linked server
{ EXEC | EXECUTE }
( { @string_variable | [ N ] 'command_string [ ? ] ' } [ + ...n ]
[ { , { value | @variable [ OUTPUT ] } } [ ...n ] ]
)
[ AS { LOGIN | USER } = ' name ' ]
[ AT linked_server_name ]
[;]

Source: MSDN.MICROSOFT.COM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top