SQLTeam.com | Weblogs | Forums

Create Table and add constraint

sql2012
sql2014
sql2008r2

#1

Create Table and constraint from two different databases?

LBR.StorePayCycle table and LBR.PaySchedule table which is in the same database name POSLabor but the tbl.UnitDescription table is in another database which is LANDRY_DATA database. Any Help is appreciated!!!


#2

What have you got so far? Is the second database on the same instance? If not is the instance linked?


#3

Same instance


#4
select -- your list here
from database1.schema.table t1
join dababase2.schema.table t2 -- your criteria here

Notice I have not given too much information as you have not shown what you have so far.


#5

I have created a table Labor.LBR_StorePayScale but i need to relate this to other two tables where one table is in different database.