I'm trying to create a merge publication using script. For example:
exec sp_addmergearticle @publication = N'MaxLoadBalance_Repl', @article = N'workorder', @source_owner = N'dbo', @source_object = N'workorder', @type = N'table', @description = N'', @creation_script = N'', @pre_creation_cmd = N'truncate', @schema_option = 0x000000010C034FD1, @identityrangemanagementoption = N'none', @destination_owner = N'dbo', @force_reinit_subscription = 1, @column_tracking = N'false', @subset_filterclause = N'', @vertical_partition = N'true', @verify_resolver_signature = 1, @allow_interactive_resolver = N'false', @fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0, @delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'true', @partition_options = 0 exec sp_mergearticlecolumn @publication = N'MaxLoadBalance_Repl', @article = N'workorder', @column = N'wonum', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1 exec sp_mergearticlecolumn @publication = N'MaxLoadBalance_Repl', @article = N'workorder', @column = N'parent', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1 . . . . .
Although I have removed a number of columns from the article; so the total number of columns be less than 246, still I'm getting the following error:
Msg 20068, Level 16, State 1, Procedure sp_addmergearticle, Line 831 [Batch Start Line 296]The article cannot be created on table '[dbo].[WORKORDER]' because it has more than 246 columns.
When I count the number of columns I've added to that specific article, they are not more than 220! then why I'm getting this error?! and how to solve it?