How to set a default value for one column in SQL based on another column

后端 未结 8 774
耶瑟儿~
耶瑟儿~ 2021-01-02 00:12

I\'m working with an old SQL 2000 database and I don\'t have a whole lot of SQL experience under my belt. When a new row is added to one of my tables I need to assign a defa

8条回答
  •  我在风中等你
    2021-01-02 00:48

    I would use a trigger on Insert.

    Just check to see if a value has been assigned, and if not, go grab the correct one and use it.

提交回复
热议问题