sql 修改字段長度以及其他屬性

2022-07-20 09:48:11 字數 1413 閱讀 4610

修改字段長度 

語法 :alter table 《表名》 alter column 《欄位名》 新型別名(長度)

alter  table  loaneeexpand   alter column   pro_series  varchar(50)

--新增帶預設值的字段

altertabletmptableaddnewintdefault1

--修改該欄位,必須先刪除 預設值約束

altertabletmptabledropconstraintdf__tmptable__new__7d79703e

--修改字段型別

altertabletmptablealtercolumnnewbigint

--欄位重新命名

execsp_rename'tmptable.new','big','column'

--刪除字段

altertabletmptabledropcolumnbig

sql修改字段長度的語法:

alter table 表名 modify 欄位名 字段型別;

sql修改字段長度的示例**

alter table qtline modify qtl_bidernote varchar2(4000);

標準sql,對任何資料庫都適用

alter table fzrtmis.reporttemplate modify repname varchar(100);

修改欄位名名稱

alter table  tablename rename column col1 to col2;

新增字段

alter table fzrtmis.itiembuildqk add  stationstate  char(1)

sql修改字段長度

語法 alter table 表名 alter column 欄位名 新型別名 長度 示例 假如有名t1,欄位名f1,原來f1為varchar 3 現在要改為varchar 10 則可以這麼寫 alter table t1 alter column f1 varchar 10 一般地,改欄位名可以用...

Oracle修改字段長度以及計算天數

sql修改字段長度的語法 alter table 表名 modify 欄位名 字段型別 sql修改字段長度的示例 alter table qtline modify qtl bidernote varchar2 4000 標準sql,對任何資料庫都適用 alter table fzrtmis.rep...

Oracle批量修改字段長度

查詢表中字段型別是str並且字段長度小於30的字段 select from sy serv item where serv id kszx ht and item field type str and item field length 30 將表中字段型別是str並且字段長度小於30的字段改為長度...