| Author |
Topic |
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2010-03-31 : 13:16:48
|
I need to update all of my foreign keys on multiple databases to be NOT FOR REPLICATION. When I run the following...Update sys.foreign_keys Set is_not_for_replication = 1where is_not_for_replication = 0 AND Is_System_Named = 0 I get an error...Msg 259, Level 16, State 1, Line 1Ad hoc updates to system catalogs are not allowed.1. Does anyone know if this update would work or will I screw something up?2. How can I get around the error?TIA,Ken2. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-31 : 13:23:42
|
| it wont work. You cant update system tables/views like this. can i ask what you're trying to do here?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2010-03-31 : 21:44:04
|
| Try ALTER TABLE.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2010-04-01 : 11:47:07
|
| I'm trying to change all of the Foreign Keys in a database to NOT FOR REPLICATION. I can't figure out the ALTER TABLE syntax to do such...alter table [t_spn_item_count_hist] check constraint [FK_T_SPN_IT_REFERENCE_TM_SPN_I] NOT FOR REPLICATIONgives me a syntax error |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2010-04-03 : 00:22:23
|
| Since I usually start from a backup from the primary database, I disable the FKs after I restore the backup on the subscriber..Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2010-04-05 : 10:51:30
|
| Nope - no help guys. I know I can disable them but I am trying to keep an exact copy of the db for possible restoration. Plus I am not in control of the creation of the original DB otherwise they would already have the NOT FOR REPLICATION set. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2010-04-06 : 13:35:28
|
| You would restore the database from your publisher onto your subscriber and disable the constraints on the subscriber. Your source DB would not be changed. Of course, when you setup replication there will be a bunch of replication related stored procs on the publisher DB. The NOT FOR REPLICATION option would be set on the subscriber. Basically you are telling the SQL Server that the configuration option be disabled for REPLICATION.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2010-04-07 : 08:30:22
|
| I understand what you are saying, however the subscriber db is where all of the data is generated. The publisher is just collecting the data from the subscriber. I know this is somewhat backwards, but it's because we use web synchronization so our clients do not have to make any firewall changes. I could disable the constraints on the publisher, but I just don't like to do that for various reasons. |
 |
|
|
|