Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.sqlserver.programming > #31335

Cause of "The referenced entity ‘tablename’ was modified during DDL execution" (error 2021)?

From John Hardin <jhardin@aptos.com>
Newsgroups microsoft.public.sqlserver.programming
Subject Cause of "The referenced entity ‘tablename’ was modified during DDL execution" (error 2021)?
Date 2017-10-25 18:50 +0000
Organization Netfront http://www.netfront.net/
Message-ID <osqmd1$gvb$1@adenine.netfront.net> (permalink)

Show all headers | View raw


Folks:

Our application has a helper SP that creates lightly-customized work SPs 
from a generic SP template. It customizes the template SP's code into a 
nvarchar() and then uses sp_executesql to create the custom work SP from 
that so it can be executed.

This has been working reliably for *years*. This week we've started 
getting scattered reports of that helper SP dying with this error when it 
tries to run the customized SQL to create the work SP:

  Error executing command "create_work_stored_proc_$sp": The referenced
  entity 'some_table' was modified during DDL execution. Please retry the
  operation.

...where "some_table" is one of the tables referenced by the template SP 
code.

Searching the web for that error either by the text or by the error number 
(error 2021) only finds notes that this error does exist in (some) lists 
of SQL Server error messages. I can't find any explanation of the actual 
cause anywhere.

I would be shocked if data changes to the table in question (DML 
operations) would cause this error. I would be less surprised if it was 
colliding with another DDL operation (like, most plausibly, a statistics 
update or online index rebuild on that table). It's possible that data 
maintenance and process execution schedules have accidentally overlapped 
here and there, and this is the result.

Can anyone provide any concrete information as to what actually causes 
this error to occur?

Thanks!

-- 
John Hardin KA7OHZ
Senior Retail Applications Developer
Aptôs
  web: http://www.aptos.com
email: <jhardin@aptos.com>

Back to microsoft.public.sqlserver.programming | Previous | Next | Find similar


Thread

Cause of "The referenced entity ‘tablename’ was modified during DDL execution" (error 2021)? John Hardin <jhardin@aptos.com> - 2017-10-25 18:50 +0000

csiph-web