SQL Server - database authentication - Asked By sammy mc on 28-Feb-12 11:19 AM
I have 2 databases with 2 user accounts for each database. I want to access the other database table information from the one database with existing user access.
db1 - user1
db2 - user2
on db1 using user1 get db2.table1 info
Thanks in advance.
Web Star replied to sammy mc on 28-Feb-12 11:44 AM
If both database on the same server than you easaly access one database table in another by using double dot
eg if you write query in db1 than you get also get data from db2's table directly.
Select * From db1.tblnameofdb1
Select * from db2..tbnlameofdb2
Otherwise you can use userid password for both database as two different connection string and put the code seprately for both with two different connection string.
hope this helps you