Drop Columns

  • I am trying to drop some columns in one table but i am getting following errors.

    Server: Msg 4922, Level 16, State 3, Line 1

    ALTER TABLE DROP COLUMN LastResult failed because STATISTICS hind_59_95 accesses this column.

    ALTER TABLE DROP COLUMN DialCount failed because DEFAULT CONSTRAINT DF__main data__DialC__14E87C29 accesses this column.

    Any body help me. Table have 96 millions records.This is very urgent

  • You need to first drop the constraint as well as the statistics using ALTER TABLE DROP CONSTRAINT <tablename>.<ContraintName> and DROP STATISTICS <tablename>.<statisticsname>

  • I drop the statistics and after that i drop the column sucessfully.but still i have one more column problem , i am trying to drop Constraint but i am getting error message

    Server: Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'CONSTRAINT'.

    I am using following syntax

    DROP CONSTRAINT [Main Data Table].DF__main data__DialC__14E87C29

    Please help me somebody

  • DROP CONSTRAINT isn't a free standing SQL statement. It is part of the ALTER statement.

    ALTER tablename

    DROP CONSTRAINT constraintname

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply