question

divyanshu_pathak avatar image
divyanshu_pathak asked

Error while adding articles at the time of creating publication in sql server replication in SQL 2014

Hi All,

I am experiencing some issues while adding articles at the time of creating publications in SQL Server replication in SQL 2014, Which is given below (Also attaching some screenshots related to this error) :-

  1. Adding article 185 of 185 (Error). Messages - SQL Server Management Studio could not create article 'myDemoTable'. (New Publication Wizard). ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) - Cannot insert the value NULL into column 'table_id', table 'myDemoDb.dbo.IHarticles'; column does not allow nulls. INSERT fails. Changed database context to 'myDemoDb'.
    The statement has been terminated. (Microsoft SQL Server, Error: 515)For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.2269&EvtSrc=MSSQLServer&EvtID=515&LinkId=20476 (For this error, we set default value of table_id to 0, but this is not the best solution).
  2. Adding article 185 of 185 (Error). Messages - SQL Server Management Studio could not create article 'myDemoTable'. (New Publication Wizard). ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. Microsoft.SqlServer.ConnectionInfo). Cannot insert the value NULL into column 'publisher_id', table 'myDemoDb.dbo.IHarticles'; column does not allow nulls. INSERT fails.Changed database context to 'myDemoDb'.The statement has been terminated. (Microsoft SQL Server, Error: 515)For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.2269&EvtSrc=MSSQLServer&EvtID=515&LinkId=20476 (For this error, we set default value of publisher_id to 0).
  3. Adding article 185 of 185 (Error). Messages - SQL Server Management Studio could not create article 'myDemoTable'. (New Publication Wizard). ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo). Update or insert of view or function 'dbo.sysarticlecolumns' failed because it contains a derived or constant field.Cannot generate a filter view or procedure. Verify that the value specified for the @filter_clause parameter of sp_addarticle can be added to the WHERE clause of a SELECT statement to produce a valid query.Changed database context to 'myDemoDb'.Msg 156, Level 15, State 1: Incorrect syntax near the keyword 'from'. (Microsoft SQL Server, Error: 4406)For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.2269&EvtSrc=MSSQLServer&EvtID=4406&LinkId=20476

sql 2014
error.png (83.8 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Elysian avatar image
Elysian answered

Hi ,

First try to drop and re create your replication...i mean delete ur subscriber ,publication everything and try to initiate it again.

If this wont work the go with below step

1) Execute the below sql in your distribution database

select id, name from distribution.dbo.MSLogReader_agents

get the value of ID here

2) Now check your log reader agent or merge agent(if it is merge replication)

>> go to job step 1 and check the value of agent id ....it should be same to the value of ID you got in step1 .If it is not change the value in your job step.

Hope this solution work. Let me know further status

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Elysian avatar image Elysian commented ·

Also,try to make sure when you are removing replication. It should remove distribution database along with all the associated jobs.

1 Like 1 ·
Elysian avatar image Elysian commented ·

@WRBI-your input on this

1 Like 1 ·
WRBI avatar image WRBI Elysian commented ·

Think you've got this one covered mate! Good work!

0 Likes 0 ·
Elysian avatar image Elysian commented ·
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.