0

I have the following query in SQL Server:

SELECT
   nume, SUM(cantitate) AS Expr1
FROM 
   bon_produse
WHERE
   (bonid = @p1)
GROUP BY 
   nume

I get the error from title and I cannot figure it out how it is wrong...

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Sampath
  • 63,341
  • 64
  • 307
  • 441
Stack Overfolow
  • 671
  • 1
  • 8
  • 19
  • Seems like there are some records in bon_produse table which have foreign keys defined, but parent rows have been deleted! Check for the constraints applied on bon_produse table! – Arsalan Adam Khatri Dec 02 '12 at 09:43
  • Seems like you have a primary or unique key defined in the DataTable, but not updating it. – Dev Dec 02 '12 at 09:57
  • The *data table* used to store the results of this query is the source of this error. Check the *constraints* defined on nume and Expr1 columns. – Bogdan Sahlean Dec 02 '12 at 10:01

0 Answers0