I'm trying to use the Modify option to graphically update the columns

  • Bare with me, my knowledge of SQL Server is next to nothing as you can see by the famous AdventureWorks database I am working on. 🙂

    Originally what I was trying to do is use the ALTER statement to add a primary key to a table that didn't have one. I first added CountryID column to the Country table with the ALTER statement but didn't specify the nulls. Apparently you can't add a Primary key unless NOT NULL is specified.

    So I tried to modify the column with the graphic modify option and when I change the NULL or change the datatype nothing gets update. I tried hitting refresh on the database..nothing. I'm obviously missing something here. So does the modify option work? How do you get it to update the tables?

  • There should be a save option. T-SQL is always cleaner 🙂

    alter table Countries

    drop column CountryID

    go

    alter table Countries

    add CountryID int IDENTITY(1,1) PRIMARY KEY NOT NULL

    go

  • I did try the save option but I was getting someone kind of transport error? It was weird but it wouldn't let me save it.

    Thanks that code did work..though the Countries part was a bit off(Its Country 😉

    Also when I executed the code and refreshed the database the object explorer didn't update the changes until I hit refresh like 3 times. Is that normal?

  • NP 🙂

    Seems to happen to me every so often although I must admit I don't use the UI that much 🙂

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

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