I'm creating a trigger that should create or delete data on a table on another database than my own. If the database is running on a different server, I can add a linked server, and be able to access it that way.
But what if both databases are running on the same sql server, but with different usernames and passwords? How can I give Db1.user1 access to Db2? I guess one solution is to add user1 to Db2, but can I also "tell" sql server that when Db1.user1 is trying to access Db2, please use user2?
I am running Ms SqlServer 2008 r2
you can use linked server connection not only to connect to a remote server but also to link to another database on the same server ... and specify credentials if needed ...
Related
I need to verify data between and Oracle db and a Microsoft SQL server db to verify that if there differences between the two and then update the Microsoft SQL server with any changes there may be
You can use/create database links. That means that you have to have oracle client installed on your sql server though.
You may configure connection to Oracle as linked server in SQL Server and use MERGE to synchronize date in SQL Server agent's job, for example. Fetching data from linked server could not the fastest thing in the world, but it is very easy to configure and use.
Use OPENQUERY with TNS alias already configured in tnsnames.ora file
I have assigned to update my server database from local database (both running with SQL Server 2008 Express). I have many new data on my local and now I want to move all to server but without changing servers data. Is there any way I can do it automatic?
You can alsouse tools which generate diff scripts, like this one for schema or see here
I'm using SQL Server 2005. I have a query to a server that gives a huge result set and I'd like to save that in a view on my local server.
Is there a way to either create a view from the server to my local server database directly, or export the result set locally and import it into my local server's database.
Thanks!
You could use OPENDATASOURCE or a linked server query from your local server to the remote server. That would allow you to create an object such as a temporary table locally and populate it with data from the remote server.
There is plenty of information on implementing this in Microsoft's online documentation.
Creating a view on the local server will not help you much, as physic data is stored on the remote server.
You can create a table on the local server from the view and use it instead.
Its a two step process: first you'll want to make a linked server. Then you'll need to create a view of a select statement on that.
If your data is currently on Server A, you'll need to make a linked server on Server B, referencing A.
Then (assuming your using SSMS), you can browse to that table, right click and chose select. This will show you exactly how to refernce the table. Then add a "create view [viewname] as" to the top and execute.
I am writing stored procs for a new system in SQL Server 2008 but I need to also update data in an older db - SQL Server 2000. I have searched but haven't found any solution to this. Is it possible? What are my choices?
Thank you!!
If you mean connect to and query against a SQL Server 2000 database, then yes, this is possible through the use of linked servers assuming that the two database servers are able to communicate with each other on the same network.
See Linked Servers for more.
This has been asked and answered in another thread, but here's a great link to get you on your way:
http://msdn.microsoft.com/en-us/library/ms188279.aspx
The concept you're looking for is called a "linked server", which allows SQL Server to send SQL commands to a remote server.
How do I select data from a MS SQL Server from MySQL? We have a system of linked server in SQL Server. I have also heard that you can do a linked server to Mysql from sql server. But I want to know the reverse.
The mssql server is what we use mainly for production. So one main reason we'd want to do this is simply to get the exact mssql server's time.
I dont think it will be possible, reverse is possible with only .Net scripting support. However, you may setup a time synchronization mechanism between two servers.