Getting an error "commit failed object type transaction sale item key"key number" while completing

Getting an error "commit failed object type transaction sale item key"key number" while completing

Problem Statement :-

Getting an error "commit failed object type transaction sale item key"key 

number" while completing the sale transaction  

  

 

  

Solution:- 

Check the  db fragmentation  by using below query 

 

 

 

SELECT top 100 OBJECT_NAME(i.OBJECT_ID) AS TableName, i.name AS IndexName, 

indexstats.avg_fragmentation_in_percent​

FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') 

indexstats​

INNER JOIN sys.indexes i ON i.OBJECT_ID = indexstats.OBJECT_ID​

WHERE indexstats.avg_fragmentation_in_percent > 30​

AND i.index_id = indexstats.index_id​

ORDER BY 3 desc 

If the fragmentation is very high then optimize the db