I am trying to extract a part of data into a temp table on a different database on a separate SQL server. Here's the query for that:
SELECT [DB1].[dbo].T1 .Col1, [DB1].[dbo].T2 .Col1, [DB1].[dbo].T1 .Col2, [DB1].[dbo].T2.Col2
It's not recognizing DB2 here. When I run this query under SQL Server Management Studio, it gives an error:
Database 'DB2' does not exist.
If I comment out the line2 in above query, it compiles and works fine.
Any idea on how to fix this problem?