Creating View | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Creating View

Hi, Can anyone help me out in How to create a view from two tables which are located in two different servers? Thanks in Advance. Regards, N.Babu Godson Samuel
Create View yourView as
Select T1.col1,t2.col1 from DB1.dbo.table1 T1
inner join DB1.dbo.table2 T2 on t1.keycol=t2.keycol Madhivanan Failing to plan is Planning to fail
Hi Madhivanan, Thanks for your reply. But my scenario is that I have to create a view by linking two different tables which are located in two DIFFERENT SERVERS. N.Babu Godson Samuel
Hi,
Replace the db1 name with your db2 name like Create View yourView as
Select T1.col1,t2.col1 from DB1.dbo.table1 T1
inner join DB2.dbo.table2 T2 on t1.keycol=t2.keycol
Then you need to add other Server as Linked Server sp_AddlinkedServer ‘otherServer’ Then Create View yourView as
Select T1.col1,t2.col1 from DB1.dbo.table1 T1
inner join OtherServer.DBName.dbo.table2 T2 on t1.keycol=t2.keycol Madhivanan Failing to plan is Planning to fail
Hi,
then you have to first ensure that its prperly maped using sp_addlinkedserver and both servers user account are mapped with sp_linkedsrvlogin and then use it as
[srv1].[db1].[dbo].[table] in your sql syntax. HTH
Regards Hemantgiri S. Goswami
[email protected]
"Humans don’t have Caliber to PASS TIME , Time it self Pass or Fail Humans" – by Hemantgiri Goswami

Thanks for all. I will try it out and i will post the result in this forum.
Thank You. N.Babu Godson Samuel
Thank you. It worked and I am able to access the data using linked server. Thank you all N.Babu Godson Samuel
]]>