Reputation: 11
I am scripting out the foreign keys for a SQL Server database, and so far I have been able to find all the pertinent information to add a foreign key to the table. The only piece of code that is missing is the 'NOT FOR REPLICATION' (see below) Does anyone know where does this piece of information live?
ALTER TABLE [dbo].[Accountxxxx] WITH NOCHECK ADD
CONSTRAINT [FK_Accountxxxx_Accountxxxx_zzzz]
FOREIGN KEY([D_XX_Guid])
REFERENCES [dbo].[second_table_name] ([Guid])
NOT FOR REPLICATION
Thanks, E.
Upvotes: 0
Views: 389
Reputation: 239754
sys.foreign_keys
contains that information in a fairly straightforward fashion:
is_not_for_replication bit FOREIGN KEY constraint was created by using the NOT FOR REPLICATION option.
If that's not what you're after, perhaps you can elaborate on how you're doing your scripting (SSMS should be scripting this option as appropriate).
Upvotes: 1