I Have had to rebuild a database for a customer and whilst most of this process has worked well I have come up against a problem. On three tables when I run code similar to that below:
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[FK_GroupUserMap_User]') AND parent_object_id = OBJECT_ID(N'[GroupUserMap]'))ALTER TABLE [GroupUserMap] WITH NOCHECK ADD CONSTRAINT [FK_GroupUserMap_User] FOREIGN KEY([UserInfoKey])REFERENCES [UserInfo] ([UserInfoKey])