在Sybase数据库里
alter table tab_oa_dep_work modify dwcontent text
go
Sybase不支持字段属性直接修改为text和image属性
因为用户表里有数据,但现在要改为大字段,此路不通,只能通过其他方法实现了
下面介绍一种用sql脚本实现此修改:
--更改部门上报dwcontent字段为text
--先创建一张临时表
create table tab_tmp_oa_dep_work (
id varchar(10) not null ,
issuenum varchar(10) null ,
weekoder int null ,
begindate varchar(20) null ,
enddate varchar(20) null ,
dep varchar(60) null ,
content text null ,
filldate varchar(20) null ,
opcode varchar(10) null ,
constraint pk_tab_tmp_oa_dep_work primary key (id)
)
go
--取出现在表里数据,插入临时表
insert into tab_tmp_oa_dep_work select id,issuenum,weekoder,begindate,enddate,dep,content,filldate,opcode from tab_oa_dep_work
go
--删除要修改的表,然后重建
drop table tab_oa_dep_work
go
create table tab_oa_dep_work (
id varchar(10) not null ,
issuenum varchar(10) null ,
weekoder int null ,
begindate varchar(20) null ,
enddate varchar(20) null ,
dep varchar(60) null ,
content text null ,
filldate varchar(20) null ,
opcode varchar(10) null ,
constraint pk_tab_oa_dep_work primary key (id)
)
go
--再从临时表里,把数据导入到修改后的表
insert into tab_oa_dep_work select id,issuenum,weekoder,begindate,enddate,dep,content,filldate,opcode from tab_tmp_oa_dep_work
go
--数据导完后,再删除临时表,从而完成了表的修改工作
drop table tab_tmp_oa_dep_work
go