Server replication

xiaoxiao2021-03-06  40

Now there are two SQL Server under the local area, store the same library and table, assuming that the data in the A server is called AS, there is a tab called AT, and there are three fields in the table. The fields in the AT table under the AS server are the following Id name Time1 B301 42 C203 53 D403 64 E504 8

There is a library name, the same table name, the same table name, the same table name, the same table name, the same table name.

I want to add data to the B server when I join a data in the A server, so that the data in two tables in both servers keeps synchronous and exactly the same?

Can you tell me if you know? -------------------------------------------------- ------------

Solution 1, 1, first establish a connection server 2, establish a trigger

Program 2, SQLServer copy function

For the solution one, transfer to you: / ******************* link database ***************** ************** / EXEC OpenDataSource ('sqloledb', 'Data Source = Remote IP; user ID = sa; password = password'). library name .dbo. Store

Select * Into local library name .. Name from OpenDataSource ('sqloledb', 'data source = remote IP; user ID = sa; password = password'). Database name .dbo. Table name

INSERT local library name .. Name Select * from OpenDataSource ('sqloledb', 'data source = remote IP; user ID = sa; password = password'). library name .dbo. Table name

Or use a coupling server: exec sp_addlinkedServer 'alias',' ',' msdasql ', null, null,' driver = {sql server}; server = remote name; UID = user; PWD = password; 'exec sp_addlinkedsrvlogin @ rmtsrvname =' Alias', @ useseelf = 'false', @ locallogin = 'sa', @ rmtuser = 'sa', @ rmtpassword = 'password' Go can then you can ask: SELECT * from the alias. Library name .dbo. Name INSERT Table name. DBO. Table name Select * from alias. Table name .dbo. Table name Select * INTO library name .dbo. New table name from alias. Database name .dbo. Act of the GO trigger:

转载请注明原文地址:https://www.9cbs.com/read-86292.html

New Post(0)