dbTalk Databases Forums  

FK on a column to a table where the column is not the PK but a Unique Index

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss FK on a column to a table where the column is not the PK but a Unique Index in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gradeaaguy@aol.com
 
Posts: n/a

Default FK on a column to a table where the column is not the PK but a Unique Index - 05-13-2005 , 03:47 PM






Hello everyone, I am new to ERWIN and I need helps from the experts out
there.

We are using ERWin 4.1.2771 and have reversed engineered some MS SQL
Server 2000 databases.

The problem we are having is that we have a FK on a column to a table
where the PK of the referencing table is on another column (such as an
identity column). We have a unique index on the column in the PK table
and SQL Server allows you to build a FK reference even though the
column is not defined as the PK.

Does anyone know how to create this type of FK within Erwin?

Thank You


Reply With Quote
  #2  
Old   
--CELKO--
 
Posts: n/a

Default Re: FK on a column to a table where the column is not the PK but a Unique Index - 05-13-2005 , 04:26 PM






Standard SQL allows you to reference any UNIQUE() constraint from a
FOREIGN KEY. Indexes do not exist in Standard SQL, so be sure to use
the UNIQUE() constraint.


Reply With Quote
  #3  
Old   
David Portas
 
Posts: n/a

Default Re: FK on a column to a table where the column is not the PK but a Unique Index - 05-13-2005 , 05:34 PM



Use a unique constraint rather than a unique index.

--
David Portas
SQL Server MVP
--



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.