ALTER TABLE modifies tables with one or more objects accessing this column

Source: Internet
Author: User

Occurs when a table is modified.

Message 5074, Level 16, State 1, line 2nd

Object ' df__ddczjlb_m__ddczj__5bba8402 ' depends on column ' Ddczjlb_groupid '.

Message 4922, Level 16, State 9, line 2nd

ALTER TABLE ALTER COLUMN DDCZJLB_GROUPID failed because one or more objects accessed this column.

Workaround:

Remove Constraint method:

1, right-click the table name, select "Design Table"

2, after entering the table design form, right button, select attributes, remove the constraint.

Method Two

1. Find out the constraint name of the field in the table (or according to the existing hint and object ' df__****** ')

DECLARE @name varchar (50)

Select @name =b.name from sysobjects b join syscolumns A on b.id = A.cdefault

where a.id = object_id (' tablename ')

and a.name = ' columname '

2. Delete the existing constraint

EXEC (' ALTER TABLE tablename drop constraint ' + @name)

3. Then execute the script that modifies the field type.

Or, turn off all the programs that use this table.

If not, you can use

ALTER TABLE DDCZJLB DROP constraint df__ddczjlb_m__ddczj__5bba8402 (object), deleted after execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.