I found something today in one of my databases that I cannot explain. I noticed on one of my tables that there was a foreign key made up of two fields which referenced the same two fields on the same table. These two fields were also the same two fields which made up the composite primary key. For example:
Table: Listings
Primary Key: MlsNumber (int), MlsBoard (int)
Foreign Key: PK Table: Listings (MlsNumber, MlsBoard) FKTable: Listings(MlsNumber, MlsBoard)
When I saw this I assumed I had accidentally created it at some point. Then I found the same thing in 4 more tables in the same database. I am the only person who can modify this database, and this is not something I did intentionally. I did notice that in every case where I found it, it was on a table with a composite primary key. I have many other tables in the same database which have composite primary keys and do not contain this odd foreign key.
Does anyone know what would create this? The server is SQL Server 2008.