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
 General SQL Server Forums
 New to SQL Server Administration
 Subscriber and publisher schema does not match

Author  Topic 

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2010-03-10 : 09:15:56
Hello All,

I have a situation where need to setup a publisher and subscriber but the table structure does not match between source and destination DB.

The Publisher has four columns and subscriber has five columns. The data is coming from multiple publishers to this subscriber.

I know that I have to change the replication stored procedures (Ins, Upd, Del) to hard code the fifth column. But how to I setup the publisher and subscriber initially? I do not want snapshot becuase I will bcp the data manually due to the schema difference.

I need to know -
How to create publisher (any caution at the properties level)
How to setup subscriber without snapshot
How to start synchronization after BCP to continue reflect the changes at destination DB.

Please any help would be greatly appreciated.

Thanks,
-P

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-10 : 14:36:18
We have a similar setup as you. Setup replication normally, allowing replication to create the stored procedures. Then after it is done, overwrite the stored procedures with your changes.

In the replication config, you can specify that the schema and data are already present.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2010-03-10 : 15:04:27
Thanks tkizer for the reply.

Replication Config means publication\article properties correct?

So basically create the publication as usual with defining correct properties at the article level. Then create subscription using GUI but do not initialize the snapshot as it will be created manually.

Is that correct?

One more question -
One article has column sequence change at publication and subscriber. The snapshot agent fails as it is doing BCP. I can manually add the add but do I have to make any change to the repl. stored procedures? I mean change column sequence...

Thanks,
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-10 : 16:13:01
Yes that is correct for both questions.

For the sequence question, I'm not sure. Could you show us a data example of what you mean?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2010-03-10 : 20:56:57
Thank you Tara.

Sorry for not giving you enough details. There a table replicating from 2 publishers.
Publisher1 -
Table1
col1, col2, col3

Publisher2 -
Table1
col1, col3, col2

If you see the columns have different order.

When I took snapshot from publisher1, it created the schema on subscriber as there in publisher1 for Table1. But when I take snapshot from publisher2 it fails because BCP is not mapping the column order with destination when exporting the data.

This is my second problem.

I can manually insert the data but do you think I will have to make any change to the repl. SPs.

Thanks,
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-10 : 23:55:43
I don't think so as they reference the columns by name, but you should double check.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -