SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Alter Table

  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    Buffalo, NY
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Alter Table

    I am trying to change from a datatype of INT to a datatype of NUMERIC(28,0) and am having problems with the query here is the Query:


    ALTER TABLE AbsentTypes ALTER COLUMN AbsentTypesID NUMERIC(28,0)

    and here are the errors

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

    any ideas?

    I'm using: SQL 7 and SQL 2000

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    we'd have to see the table layouts, eh
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    695
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    If the column AbsentTypesID is part of the primary key, you need to drop the primary key constraint before the table can be altered. After the alteration you can recreate the constraint


Bookmarks

Posting Permissions

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