.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Merge replication - table with geography data type

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Sql Server


I have a problem with geography data type replication. Any change that is done on a Geography column breaks the replication - the error message is "The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber." I double checked compatibility settings that is suggested here: http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/d8e31621-5d43-48cd-bdd3-c02b8a24625c. But both publisher and subscriber are 100RTM.

I checked synchronization logs and found a strange message - attempt to convert varchar to geography. I don't understand from where the varchar data type comes from. Tables at subscriber and publisher has the same format - geometry stored in geography data type.

2010-09-20 18:36:22.499 The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber. This can occur when there are pending DDL changes waiting to be applied at the Subscriber. Restart the Merge Agent to apply the DDL changes and synchronize the subscription.
2010-09-20 18:36:22.845 Category:NULL
Source:  Merge Replication Provider
Number:  -2147199398
Message: The

View Complete Post

More Related Resource Links

Changing column Data Type when using merge replication: RFC on my SMO code.


I maintain an application for that uses SQL 2005 / 2008 for data persistence.
Some clients use Merge Replication (pull or push) to replicate data.

Some of the data the application stores should be "versioned". All versions of a row containing medical information should be stored, somewhere in a database. This means all updates and deletes to those rows should result in in 2 affected rows:

  • a copy of the row before the change
  • a row containing the change (or the deletion of the row in question)

I plan to achieve this using triggers on all the tables for wich "versioning" is required.
The old versions of a row may be stored in the same database, an other database (or a database on a linked server).

Unfortunalty, the AFTER UPDATE, DELETE triggers do not support TEXT, NTEXt an IMAGE data type columns.
Thus I am required to convert all text, ntext and image columns to their respective "new" data types, varchar(max), nvarchar(max) and varbinary(max).

This is not a big issue when the database is not published, but when it is... most articles (and posts) i've read suggest:

  1. Add a column of the target data type to the table, copy data from source column. rename columns and drop the source column.

  2. Create a temp table (with the s

SQL 2008 geography type replication

Hi, I am attempting to get merge replication going between two SQL 2008 servers.  So far, everything has gone off without a hitch with one exception.  We use spatial data on a daily basis in my organization, so we implemented the geography data type.  This data type seems to be causing all of our replication issues.  I can easily create publications and subscriptions for each article in the entire database except the geography field. The error is as follows: "The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber. This can occur when there are pending DDL changes waiting to be applied at the Subscriber. Restart the Merge Agent to apply the DDL changes and synchronize the subscription." The real kicker is that the schemas are exactly the same.  If I set the publication to drop and recreate the subscription article, then to convert the geography data type, it works without issue, but then we run into issues with our publication database not matching exactly with our subscription database, which could cause many potential problems with our web front end.   Is there a known issue with replicating the geography data type?  Any help is very much appreciated! - Chad  

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

Merge replication unique id of table

Hi guys,I am designing a CRM solution using SQL Server 2008 and windows forms.The solution should allow people to work in a disconnected mode.I would like to ask for an advice about the best practice for implementing the solution.Currently I am expecting to have 1 central server with about 20 small clients.When the connection between the server and the clients falls the clients should work in disconnected mode persisting all changes to a local database. So on the Server I will use SQL Server 2008 Enterprise and for the clients SQL Server Express.I am planning to configure merge replication between the server and the clients and have the clients operate against the server until the connection drops.One question that I have in particular is what to use for ids of my tables ? I am currently using identity columns and planning to assign a range to each client and server so that ids do not overlap.But I am wandering whether not to use custom id for example a varchar(15) for example. Then I can easily assign a prefix for each client and ensure uniqueness of ids. I have also read that SQL Server adds a GUID to each table anyway so I wandered if using a GUID is a good idea ? I appreciate your answers.Regards,kzmp

Sanpshot Replication of all objects and Table Schema but no Data


Can this be done? I just want all database objects to be pushed out to a subscriber once a week via snapshot replication. Procs, tables, triggers, functions etc but I dont want any of the table data

Thanks in advance

table schema changes not being propagated - merge replication


I have attemped to change column types (i.e. from int to varchar(8)) on read-only published tables. I used ALTER TABLE ALTER COLUMN to make the change, and according to BOL this should make sure the changes are seen at the subscribers. Unfortunately, after I make the change to table and run sp_enumeratependingschemachanges, I do not see the table changes listed. However I can make changes to SPs and UDFs, and they do show up in sp_enumeratependingschemachanges and on the subscriber. Any ideas would be appreciated.
The publication is marked for replicating schema changes, the publisher is SQL 2005 and the subscribers is SQL 2005 Express btw.


Darrell Young

Passing array or table data type


I need to pass many records with number of fields(i.e 5rows and 5 columns) in either array or table form to oracle for processing. Is it possible to pass array/table from asp.net pages? If no, any solutions for this? I have been thinking of passing it as string concatenated with delimiter and split it.  Seems like it is not appropriate as i have to pass 5 strings(5rows) Any better suggestion? Thanks in advance

Merge Replication Atomicity - at what point does ALL subscriber data become visible at the publisher



I have a Merge Replication installation going on with about 35 connected devices. When one of the subscribers synchronizes, do the inserted rows appear sporadically on the publication database at different times? Or do they appear all at once?

Can all of these be isolated inside a transaction - this would seem like it should be the default behaviour, in case of a sync being cancelled or failing due to loss of connectivity etc. 

The reason for this question is that another part of the system seems to have queried the publication database during and after a subscriber synchronization with differing results. 

If this is normal, what would be the best solution to ensure data integrity? 

Thank you in advance. 


View data type doesn't reflect table


I'm not sure if this is the place for this question, but here goes.

I am running SQL Server 2005, and I've encountered an issue with view data types.  I had a client who asked if they could allow for decimals in a field that was previously an integer.  This meant going and changing the column data type on a few tables from integer to float, and changing some parameters and variables within some stored procs/functions to floats.  Somewhere the value is still being rounded down, so I queried the information_schema.columns and found about 60 views in the system that reference that column and are still being considered an int, from the tables which were already converted to float.  I've found that if I simply script the views as alter and run it the column no longer is considered an int in the information schema.

My question is this: Does this seem to be my problem, that when the view is referenced the value is changed to an int? Or does the view simply reflect the table's data type and the information schema is incorrect?  If the former, is there a faster way to update all these views without going one by one and scripting them? Thanks in advance.

Data not downloaded with SQLCE Merge Replication



I've got one problem with a merge replication and windows mobile device.

The database is stored on SQL Server 2005.
It is available with Internet via sqlcesa30.dll, hosted on an other computer.
The local db on Windows Mobile device is sqlce3.

Everything works fine since a lot of months.

But,since few weeks, some devices don't receive some rows.

I think it could be possible because the IIS server with sqlcesa30.dll had the LogOption to full and the actual log file was 800 mb.
I've flushed the file to be sure.

But, I don't know if it will be enough.

About the Event Viewer, the only thing I see is on the Server with SQL, i've got

Replication-Replication Merge Subsystem: agent 0030007B-0038-0044-3400-370042004500 failed. A read operation from the Internet returned an incorrect number of bytes. [,,,,,]


Replication-Replication Merge Subsystem: agent 0038007B-0039-0044-3700-320031003000 failed. De aanvraag voor het verzenden van gegevens naar de computer met IIS is mislukt. Zie HRESULT voor meer informatie. [,,,,,]

But, I do not have a lot of logs like this.

And i've got soo many devices that sync on this db (+-30 each 10 minutes) that it's not easy to know where is the problem.

Is someone has any idea?


PS : if found that the only solution

How to minimize time when creating 2005 merge replication with very large data files and log files?


Dear all,

We're using window server 2003 sp1 + sql ent 2005 sp2 with merge replication between 2 servers. Since 1 of server sql is down, we need to create merge replication again. However, our data file size is 60Gb and log size is 40 GB and when we create merge replication it may need more than 10 hours to finish which is unacceptable since when creating replication the online db normal service operation may be affected. Is there any other way that can reduce the replication creation time within 5 hours to finish? Thanks a lot.


P.S: we are using full recovery model and plan to change to simple recovery model. Any help?




What is the maximum size of binary data (varchar(max)) that 2005 merge replication can tolerate



Since we have experienced creating 2005 ent SP2 merge replication with 60 GB binary data requires 90 hours to finish the whole process(snapshot job + merge job), we just worry that if we still increase the database size to fill in such large binary image and it will finally make merge replication malfunctioning. Just want to ask is there any limitation on image sizes or db sizes if  merge replication need to replicate them? Do u have benchmark testing or experiment that can prove on this upperlimit?

Thanks and regards,




Merge Replication - Add table to existing publication


I added a table to an existing publication and then generated a new shapshot.  The merge agents then sent the new table and data down to the sunscribers as planned.  The issue is that at the next cycle the merge agent re-initilizes the table again.  This happens over and over again.  If I stop and restart the agent I can watch it send the schema back down to the subscriber.  Any thoughts are appreciated.



Is there no need to manually clean up merge replication system table?



In my previous post, Hilary replied that the size of MSmerge_Contents doesn't really matter, but index fragmentation does. However, referring to BOL, it says, "Additionally, you should minimize the size of the merge system tables (specifically MSmerge_history) by using sp_mergecleanupmetadata." Is it still necessary to do that in SQL Server 2005? 

Also, when running select metadatacleanuptime from sysmergesubscriptions, I found that the cleanup time is just about a week before. However, my merge interval is only 5 minutes, and I remembered during last week I did a manual sp_mergemetadataretentioncleanup although paused in half way. How to check the clean up interval?

Last but not least, I have already did index rebuild on MSmerge_Contents, MSmerge_henhistory, and MSmerge_tombstone, and found that the average fragmentation dropped from above 90% (MSmerge_Contents) to below 1%, but the overall performance did not improve obviously. I remembered when merge replication was set up at the begining, th

Checkboxes from data table


I have a data table that contains some values for Certifications.  This table can be updated in a different part of my application.  On the web page I am currently working on, I would like to have check boxes appear for every value in the data table.  I have been struggling with this trying to use a For Each loop and I cannot get it to work for anything.  Any suggestions? 

I am using the following Razor syntax to obtain my data (I know this works because I can display it in a WebGrid):


var db = Database.Open("MyConn");

How to get data from table based on four table



I need to know how to show top 30 records from four table

with fastest speed.. in ms sql server 2005..

hope You do the needfull


The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend