Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007

    Unanswered: Change datatype from varchar to bigint not working


    I would like to change the datatype on a particular column from varchar to bigint across 100's of tables within a database.

    I have the command ready which is:

    ALTER TABLE tablename ALTER COLUMN columnname BIGINT

    The problem happening is that it seems there are constraints across all the columns in every tables.

    The error message is:

    Server: Msg 5074, Level 16, State 1, Line 1
    The object 'DF__tablename__columnname__0ABD916C' is dependent on column 'columnname'.
    Server: Msg 4922, Level 16, State 1, Line 1
    ALTER TABLE ALTER COLUMN columnname failed because one or more objects access this column.

    I understand that if I delete this constraint, then it will let me modify the datatype of the column, but since there are tons of them and they are randomly named, how do I achive changing the datatype across multiple tables in bulk.

  2. #2
    Join Date
    Feb 2004
    One Flump in One Place

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts