November 25, 2008 at 11:29 am
What does this mean if you see it on a table?
ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [FK_Table1_Column1] FOREIGN KEY ([Column1]) REFERENCES [dbo].[Table1] ([Column1])
I get why you would might self reference a table but different columns, why the same column?
November 25, 2008 at 12:24 pm
Huh... I'm kind of amazed that works. I just tested it. Not only can you do it, but it doesn't affect inserts or updates. Strange.
No, I can't imagine why you would do this either. It can't accomplish anything. I just inserted and deleted with no issues.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 25, 2008 at 1:42 pm
I noticed the same behavior as well. I thought well maybe if the CASCADE DELETE or UPDATE options were not set it might prevent records from being modified or deleted. Though it worked just fine.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply