Generic constraint error
This occurred when trying to add a primary key to an existing table in SQL Server 2008R2. It was the only error.
lesniakbj last edited by
While not the same, I posted a question about errors like this on Stack Overflow; related specifically to SSMS 2005 and Stored Procs:
Answer: I'm screwed.
Either way, I see these a lot when you have stored procedures calling other stored procedures and the error messages just get gobbled up. Makes maintaining and fixing problems a nightmare.
Hmm. Well, there are no stored procedures involved here. Or even error-handling. It's just an alter table statement.
ALTER TABLE Loans ADD CONSTRAINT PK_Loans PRIMARY KEY (CUST_NBR, COL_TYP_CD, LOAN_NBR)
Edit: Also, it actually created the key. I probably should have checked that first, but I assumed that if it failed with an error it wouldn't have created the key. But it appears to be there and correct. So, that's weird.
CHUDbert last edited by
Are there any DDL triggers? That could be the cause of the error message.
blakeyrat last edited by
The previous error was served 6 days ago and dealt with a typo of a table name.
So see it!
There aren't any triggers anywhere in the database.