Forcing Management Studio to use ALTER TABLE instead of DROP/CREATE

前端 未结 4 1021
暗喜
暗喜 2021-01-11 13:49

I\'m wondering if is there a way to force MSSQL Management Studio to produce a script like this:

ALTER TABLE Mytable
ADD MyCol bit NOT NULL
CONSTRAINT MyColD         


        
4条回答
  •  北海茫月
    2021-01-11 14:24

    You can't change the behaviour, it's just that the default script it creates is not always the most efficient. It creates scripts in a format it knows will work, although frequently the results will be slow and resource-heavy. I recommend you get used to creating the script for all changes yourself as you can better optimize it. There's nothing wrong with what you've created (providing you have no existing constraints/dependencies on MyCol2 that would be invalidated by it becoming a nullable int)

提交回复
热议问题