Quantcast
Channel: DotNetBlocks - SQL
Viewing all articles
Browse latest Browse all 13

How to execute a SQL Statement using a Cross Server Call

$
0
0

How to execute a SQL Statement using a Cross Server Call.

Declare @sqltxt nvarchar(500) 

-- Create SQL statement
Set   @sqltxt = 'UPDATE 

    DatabaseName.dbo.Table
 SET  
    Active = 0       
 WHERE 
    Active = 1'  

-- Execute SQL statement on another server.
exec Server.master.dbo.sp_executeSQL @sqltxt


Viewing all articles
Browse latest Browse all 13

Trending Articles