Labels

Cannot Truncate Table Because It Is Published For Replication Or Enabled For Change Data Capture.



If you are getting this error,



SQL Server is satisfying any of below conditions:
  1. You can’t use TRUNCATE TABLE where the tables are referenced by a foreign key constraint
  2. You can’t use TRUNCATE TABLE where the tables participate in an indexed view.  
  3. You can’t use TRUNCATE TABLE where the tables participate in transactional replication 
  4. You can’t use TRUNCATE TABLE where the tables participate in  merge replication. 

Work around: Use the DELETE statement in place of TRUNCATE TABLE. because its not advisable to remove replication , CDC or index views.


Note: If none of conditions are matching "TRUNCATE TABLE" will reset your identity column to a default value of 1 


No comments:
Write comments

Please do not enter spam links

Services

More Services