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 2008 Forums
 Replication (2008)
 Replicate Schema but not table Rows

Author  Topic 

dafioga
Starting Member

3 Posts

Posted - 2014-05-09 : 14:48:20
Hi, i have SQL Server 2008 R2 and i need perform the replication between two database, production and test. But i need replicate the schema of all tables but the content of rows only for some tables, not for all. For example users, logins, logs etc.
How can i do this?
Thanks
Regards
Damián Fiorito

IT Manager Betmotion.com

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-09 : 16:19:05
Replicate just those tables you want schema+data and then just generate the schema manually for the tables you don't want the data replicated.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

dafioga
Starting Member

3 Posts

Posted - 2014-05-11 : 14:48:55
Yes but, if my development team cahnge the schema of a table i need to replicate too. So, i need replicate the schema in all tables in a recurrent way (once a day), but some of these tables i don't won't replicate data for security reasons.
So the schema could be modified and i need replicate with each modification not one time.
I'm using transactional replication but i don't see this option.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-12 : 11:38:58
You can modify the replication stored procedures for each table you don't want the data. Have the stored procedure do a no-op for those.

sp_MSins*
sp_MSupd*
sp_MSdel*

But I don't understand why you even have this requirement. It doesn't sound like you have proper source control and build deployments in place. Sounds like a cowboy environment, which needs to be fixed, in my opinion.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

dafioga
Starting Member

3 Posts

Posted - 2014-05-12 : 12:03:18
Ok, i will try with this.
Yes surely we don't have a properly source control , we are working on that. Really the requirement now is not sync the user data when we replicate the production database to our test enviroment.
Thanks for the advice, i tell you later if this work.
Regards
Damián

IT Manager Betmotion.com
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2014-05-13 : 12:40:47
Can also go to article properties in the GUI and under Statement Delivery, choose DO NOT REPLICATE INSERT STATEMENTS, update statements, delete statements
Go to Top of Page
   

- Advertisement -