4
I’m looking to relate 2 different database tables. I’m using SQL Server SSMS 17.9.1.
TBL1 in DB1
TBL2 in DB2
Scenarios:
- Both banks are on the same server;
- Database 1 is on my server and database 2 is on an external server.
Would there be a way out of these two scenarios? Initially the two banks will be on the same server, but later the BD 2 can go to another server.
Yes, with
SELECT
is possible yes. And if the two banks are on different servers, but communicate with each other, it is also possible.– Douglas Garrido
how I would do this SELECT with an external bank ?
– Gabriel Silva
As far as I know, although it is possible to access another database via FDW (Foreign Data Wrapper) in the SQL/MED standard, it is not possible to define a Constraint between different databases.
– anonimo
Have you researched LINKED SERVER ? https://docs.microsoft.com/pt-br/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine?view=sql-server-2017
– Edvaldo Lucena
@Edvaldolucena no, had never seen LINKED SERVER, I’m already taking a look at the link, thanks for the tip.
– Gabriel Silva