May 6, 2002 at 7:50 am
Hi,
I am puzzeled about a Create Table statement.
The statement is:
Create Table abc
( Field1 int PRIMARY KEY REFERENCES abc(Field1)
<other fields>
)
Creates a PK, and FK on Field1 referencing itself.
what pupose this type of reference can serve?
Checked it on SQL Server 7, SP3
Regards,
May 6, 2002 at 7:57 am
You can create a recursive table for example an employee has a manager who is also an employee.
Best regards,
Klaas-Jan Ruyter
May 7, 2002 at 8:13 am
hmmm... But in this case can't I use just another field referencing the PK?
Regards,
May 7, 2002 at 10:33 am
Kashif you are rigth in what you state as this is a bad way to reference especially the PK since it will be unique. As a friend here would say
quote:
There is a flaw in the slaw.
meaning a reference from a field directly back to itself has no reason for existance. Might want to try SP4 to see if still works then throw a bug report to MS.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply