I have two SQL server [example]:
1st - 10.101.102.133
2nd - 10.101.102.155
Both having the same database with same names and fields.
My application will update in the 1st server.
Can I actually configure the 1st server that once it received update query, it will update in 2nd server as well?
I do not wish to change my application source code but instead want to make configuration on the server itself.
Related
I have two SQL Server
1st - 10.101.102.133
2nd - 10.101.102.155
Both having the different database with different names and fields.
My application will update in the 1st server.
Can I actually configure the 1st server that once it received update query, it will update in 2nd server as well?
I want to insert data from 1st server to 2nd server by using trigger. when my Application insert data in a table in 1st server database a trigger will fire (insert trigger). and it pass the data in 2nd server by its user id and password.
How I write the script of this trigger?
Solved here: Selecting data from two different servers in SQL Server
You can use sp_addlinkedserver or Linked Servers approach.
Using sp_addlinkedserver would be something like this once you have set up the linked server:
select
*
from
LocalTable,
[OtherServerName].[OtherDB].[dbo].[OtherTable]
Can someone help me to change the server name in sql server 2008 please.
In this picture you see the server called SERVIDOR1
And if you query select ##servername you see the name I want. How can I change the first one ?
Why are they differents? I need to change the first name you see in first pic
Thanks so much
You have 2 different SQL Server instances, one is default instance, you see it as SERVIDOR1 (that is your host name), the second is named instance: SERVIDOR1\SQLEXPRESS.
You cannot change the name of default instance as well as you cannot have 2 default instances on 1 pc, so if you want to get rid of the first instance you can uninstall it.
You can see both instances in the Configuration Manager or in Windows Services.
Run a Sql Server Query on multiple Servers and each server has different databases(database name is diff on each server) with same tables
In the management studio, you can register multiple servers into one group. Then you can run query on the group.
In SSMS open Registered Servers and create a New Server Group under Local Server Groups.
Under this group create New Server Registration for each server you wish to query. If the DB names are different ensure to set a default for each in the properties. You can register a server/instance multiple times with different default DBs.
Now go back to the Group you created in the first step, right click and select New Query. A new query window will open and any query you run will be executed on each server in the group. The results are presented in a single data set with an extra column name indicating which server the record came from. If you use the status bar you will note the server name is replaced with multiple.
I am looking for a way to setup a scheduled update from a linked server I created to a local db, I am not familiar with triggers but from what I've read you have to set them up on the originating server, and I only have read access to the mysql Database. Basically all that I am trying to do is make a local copy of two tables from the mysql db. I can manually do so with select into statements, but I would like to have some automation if possible. Any thoughts on how to achieve this? Also I am using SQL server 2008 R2. Thanks!
You have several options to do:
Copy all data from the source table (do not use this if the source table is big)
If you have a column in the source table which can be used to determine which records should be copied, use that (this is mostly an auto updated timestamp column in MySQL)
Set up a trigger to track modifications
To copy, you can set up a Linked Server or you can use SSIS
To use a linked server you can use OPENQUERY()
You can schedule your task with SQL Server Agent
Is it possible to copy data from one server to another using a T-SQL script? We have a code promotion process that makes using the import wizard less than optimal for our team so I am looking into a script I can simply have someone run in Management Studio that will do the trick.
Yes,
First create a Linked Server to other server, then you can access the target server by 4 part Names, for example:
Insert into Server2.Database2.dbo.MapTable1 select * from table1
p.s you can add linked server by sp_addLinkedServer