Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have recently taken over a project, and I have discovered that in most tables the primary key has the property "NOT FOR REPLICATION".

I'm no DBA, but surely in most databases, a record without a primary key would be considered corrupted. The primary key of most of these records would almost certainly be used as a foreign key somewhere.

Was this an error on the part of the previous developer (who no longer works for the company), or is there some other logic involved? We don't even use replication in the production environment, so this doesn't actually affect anything serious anyway but I was wondering if there are any other side-effects of removing all these directives that I'm not aware of.

I haven't found many useful hits for a number of search terms related to this topic, so I'm fairly certain that this is just a silly error that I need to reverse, so this question is really to assuage my paranoia.

share|improve this question

migrated from stackoverflow.com Mar 12 '13 at 13:06

This question came from our site for professional and enthusiast programmers.

1 Answer 1

NOT FOR REPLICATION indicates that when a record is replicated to this table, any value that is inserted into the identity column via the replication agent keeps it's original value from the source system, but any records added locally still increment the identity value.

The following link explains it better than I can, it's marked as SQL 2000, but as far as I know it is still valid information:

Using NOT FOR REPLICATION

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.