SQL Server: Invalid Column Name

前端 未结 13 880
一个人的身影
一个人的身影 2020-12-22 23:49

I am working on modifying the existing SQL Server Stored Procedure. I added two new columns to the table and modified the stored procedure as well to select these two column

13条回答
  •  有刺的猬
    2020-12-23 00:18

    If you are going to ALTER Table column and immediate UPDATE the table including the new column in the same script. Make sure that use GO command to after line of code of alter table as below.

    ALTER TABLE Location 
    ADD TransitionType SMALLINT NULL
    GO   
    
    UPDATE Location SET TransitionType =  4
    
    ALTER TABLE Location 
        ALTER COLUMN TransitionType SMALLINT NOT NULL
    

提交回复
热议问题