Change column type and set not null

后端 未结 1 1012
清酒与你
清酒与你 2021-01-31 13:00

How do you change the column type and also set that column to not null together?

I am trying:

ALTER TABLE mytable ALTER COLUMN col TYPE char         


        
相关标签:
1条回答
  • 2021-01-31 13:27

    This should be correct:

    ALTER TABLE mytable
        ALTER COLUMN col TYPE character varying(15),
        ALTER COLUMN col SET NOT NULL
    
    0 讨论(0)
提交回复
热议问题