Menu

Error when Altering Table

Help
jceresini
2006-10-23
2013-04-11
  • jceresini

    jceresini - 2006-10-23

    I changed a datatype from 'bit' to 'binary' and when i clicked save table i got the follown error:

    Error: There is already an object named 'PK_Users_Temp' in the database. Could not create constraint. See previous errors.
    Source: .Net SqlClient Data Provider

    The table I altered was named Users. I was able to alter other tables, but this one threw errors. Anyone have any ideas?

     
    • Coolberg

      Coolberg - 2006-10-24

      I could reproduce the problem at my installation.

      Seems like it's doing something stupid behind the curtain. I don't have these parts of the source code at hand
      so I can't check it out any deeper.

      But, as a work-around you can do the column type change with SQL:

        alter table your_table alter column the_column binary NOT NULL

      (assuming that you want Not Null, of course. There might be other column properties you might want to set
      using the ALTER COLUMN statement also).

      Best regards,
      Coolberg

       
    • Coolberg

      Coolberg - 2006-10-25

      Now, I noticed that ASP.net EM creates an extra table called <table_name>_TEMP  .
      Can't see why, there's no essential need for an extra table for doing an Alter Table or corresponding.

       

Log in to post a comment.