We on occasion see:
Msg 8624, Level 16, State 1, Procedure ins_Group, Line 37
Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.
The statement in question that is fails on is:
INSERT INTO [Group] ( AccountId,
VALUES ( @AccountId,
The table [Group] has a single Foreign key on the AccountId column to the [Account] table.
When that foreign key is deleted another statement within the procedure returns the same error.
INSERT INTO GroupSetting ( GroupId,
FROM Setting WITH(NOLOCK)
WHERE SettingId > 0
AND SettingScopeId =
The [GroupSetting] table has two foreign keys. One to the [Setting] table and one to the [Group] table. I deleted the foreign key to the Setting table and the procedure began running without error.
This problem is intermittent, but does show up sometimes. It happens on SQL 2005 SP2 and SP3.