foreign key that references itself, parent and referenced column are the same

  • On our production box, I found a couple foreign keys that is referencing itself. Something like this:

    ALTER TABLE [Out].[Participations] ADD CONSTRAINT [FK_Participations_Participations] FOREIGN KEY ([ParticipationID]) REFERENCES [Out].[Participations] ([ParticipationID])

    My first guess was that this just silly. But perhaps there's a reason for this?

    Thanks!

    -Kevin

  • It looks like a misapplication of the Parent/child relation being in the same table. I'm not entirely sure why you'd ever do that.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks Craig. I needed someone to reassure me that there isn't something obvious I'm missing.

  • kevin.wu (4/19/2011)


    Thanks Craig. I needed someone to reassure me that there isn't something obvious I'm missing.

    No problem. Sometimes a quick sanity check is a nice thing when you're running Lone Wolf.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply