Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help on creating tables and triggers - Sybase 12.5.3

Status
Not open for further replies.

goal9

Technical User
Oct 5, 2009
1
CA
Hi All,

I created a new database and 2 tables inside but one of the tables has foreign key which can not be created as I'm getting error on the foreign key...

Can we set foreign key constarint to a table in another database? This is what I've done:

use new_database
go
create table Sample(
sample_id varchar(30) not null,
sample_type char(1) not null,
update datetime not null,
primary key(sample_id, sample_type)
foreign key (sample_id) Refrences Different_DB.table_name(Sample_id)) /* This is not working. */

I want to link the "sample_id" here in Sample table to another table in a different database which has "sample_id" as PK there.

Should I link this new database to the other databases? If so, how can I create that link?

Thanks a lot for all your comments!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top