I am a computer science student and yesterday in my class on database management systems and talking about distributed systems and good practices he said that we can reference other instances through something he called 'connetion stream' or 'connetion String 'I really did not quite understand what he said. But I raised the following question:
I theoretically own a license db, application X and application Y, are totally different applications and only share the access user. In the first database are stored company information, license and access users; In database Y and X are different data that need to share the same user that is in the license database.
I tried in SQL Server as follows:
CREATE TABLE Licences; USE Licenses; CREATE TABLE Persons( Id int identity(1, 1), Name varchar(100) unique not null, //Other user information primary key(Id) ); CREATE TABLE X; USE X; CREATE TABLE XInformation( Id int identity(1, 1), //Other X information PersonId int not null references Licenses..Persons(Id) ); CREATE TABLE Y; USE Y; CREATE TABLE YInformation( Id int identity(1, 1), //Other Y information PersonId int not null references Licenses..Persons(Id) );
But I get an error saying that sql server does not support foreign keys between databases.
But if I create these tables without referencing I can query them like this:
SELECT * from Persons as p inner join X..XInformation as xi on p.Id = xi.PersonId;
What is the correct way to do this referencing?
How would a dba solve this case?
Can I only reference other databases in Views?
Thanks in advance.