Solved

SQL Server 2008 R2 Remove Not for Replication

Posted on 2013-05-20
9
701 Views
Last Modified: 2013-07-10
I initially set up replication temporary and it removed.  

Now we've noticed the id columns have ‘FOR REPLICATION’, immediately we executed sp_removedbreplication ‘dbname’.

After executing the sp, the id column now have ‘NOT FOR REPLICATION’.  

How do you get rid of this NOT FOR REPLICATION from my id columns?


e.g.

(id)     INT       IDENTITY  (1,1)  NOT FOR REPLICATION NOT NULL,
0
Comment
Question by:Favorable
9 Comments
 
LVL 29

Assisted Solution

by:QPR
QPR earned 83 total points
ID: 39182561
0
 
LVL 9

Assisted Solution

by:MattSQL
MattSQL earned 334 total points
ID: 39182944
Is there an issue with having this there?
0
 

Author Comment

by:Favorable
ID: 39183275
Is an issue when doing schema compare inside of visual studio 2012.

Is there a way to turn if off for all table identity columns in the database?
0
 
LVL 9

Assisted Solution

by:MattSQL
MattSQL earned 334 total points
ID: 39183282
alter table tablename alter column columnname drop not for replication
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:Favorable
ID: 39184326
do you have to repeat for over one thousand objects in the database?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 83 total points
ID: 39185843
do you have to repeat for over one thousand objects in the database?
You don't have to repeat it that many time you just need to execute it that many times.
0
 
LVL 9

Assisted Solution

by:MattSQL
MattSQL earned 334 total points
ID: 39185854
Run this in the database. The output will be all of the alters that need to be run...

select
      'alter table ' +
      object_name([object_id]) +
      ' alter column ' +
      name +
      ' drop not for replication'
from sys.identity_columns where is_not_for_replication = 1
0
 
LVL 9

Accepted Solution

by:
MattSQL earned 334 total points
ID: 39272465
Has this been answered?
0
 

Author Closing Comment

by:Favorable
ID: 39314974
thanks
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now