Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL
Hello everyone,
I am having a DB say DB1 in that i am having an employe Table EmpTable where I maintain employe record and I have set a primary key there .I am having a another DB
say DB2 in that I am having a salary table where all Employe salary will be maintained . Now Instead of maintaining again the employe record in DB2 I need to give relation from DB1 to DB2 .So how can I get that thing done .
Thanks in Advance
Posted 17-Nov-12 2:40am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Like this:
SELECT t1.*, t2.*
FROM [DB1].[dbo].[EmpTable] AS t1 LEFT JOIN [DB2].[dbo].[Salary] AS t2 ON t1.EmpID = t2.EmpID

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 424
1 OriginalGriff 375
2 CHill60 230
3 CPallini 220
4 Maciej Los 210
0 Sascha Lefévre 75
1 OriginalGriff 70
2 F-ES Sitecore 55
3 Peter Leow 50
4 Dave Kreskowiak 40

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100