Hi. I have 2 different databases. I need the information from the first database to another one. ¿Can I get this information through SQL instruction? Please give me an example. Thanks.
You can reference a table in one database while in the context of another database by fully qualifying the table name.
Insert dbname1.dbo.tableA
Select col1, col2, col3, ..., colN
From dbname2.dbo.tableB
Where <your criteria>
You can use the same syntax to create a view in one database that references tables in the other database. The following example shows how to join tables in two databases.
Create View vPartInfo As
Select a.Col1, a.Col2, b.ColX, b.ColY
From database1.dbo.tableA As a
Inner Join database2.dbo.tableB As b
On a.KeyA=b.KeyB Terry L. Broadbent Programming and Computing Resources
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.