fracedo
fracedo

Reputation: 127

Make INSERT,UPDATE or DELETE inside a stored procedure from one server to a table on another server

I have this problem; I'm trying to execute INSERT, UPDATE or DELETE statements inside a stored procedure from one server to a table that is in another server.

Example: I have the server 192.168.0.3 with a database BaseA, inside I add a stored procedure spu_a. In this stored procedure I want to insert a new row into the table tableAinBaseB in database BaseB that is in the server 192.168.0.4.

How can I do that?

Upvotes: 1

Views: 613

Answers (1)

Morphed
Morphed

Reputation: 3619

I'm assuming Microsoft SQL Server.

I think you want "cross server" or "linked server" SQL. See the MSDN here. Your queries would then use 4 part identifiers like so:

Select * From Server.Database.Schema.Table

Previous employers of mine haven't liked this solution (security reasons I was told) so enforced the use of SSIS solutions. This may be a consideration for you.

Upvotes: 2

Related Questions