Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 default constrant not replicated in the subscriber

Author  Topic 

avinashily
Starting Member

10 Posts

Posted - 2011-01-07 : 06:55:04
hi all,

recently i have implemented a snapshot replication(tables only) between my production server and test server for a database on which we are doing some application testing but i see that the colums which have default value defined are not replicated properly as the value of the column in the test server is showing null. i have read some where that the default constraint defined in some stored procedure or a function is not replicated if you do not replicate the procedure or the function along with the tables, is it true?
what can i do so that even if the constraints are difined in a procedure or a function to get replicated in a snapshot replication where only tables are replicated.


// it is always suggested to do it first on the test server then implement on production server//

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-07 : 07:46:43
In the Publication Properties, set Copy Default value Specification to true.

If the default is a function, be sure that function exists on the subscriber.
Go to Top of Page

avinashily
Starting Member

10 Posts

Posted - 2011-01-07 : 09:13:58
thanks russell,

now i got the defaults values inserted in the columns but what the major issue is that i have default constraint defined in the publisher database for a column and the same column in the subscriber is not having any constraint, can you tell me what is the issue?

// it is always suggested to do it first on the test server then implement on production server//
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-07 : 12:40:19
Add the constraint at the subscriber. Then make sure the article properties are set so when the snapshot runs it keeps the default definitions and bindings.

While you're at it, might want to check that you're copying nonclustered indexes and any other options you need.

By default, the snapshot only copies the data (and table definition) but none of the indexes, constraints etc.
Go to Top of Page
   

- Advertisement -