数据库命令收集

表数据备份到另一张表:
select * into destTbl from srcTbl 
条件:destTbl表不存在
insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl 
条件:destTbl表存在

修改数据库列数据类型:
alter table [table name] modify [column name] varchar(32) null

增加列:
alter table [table name] add [column name] varchar(10) null 

删除列:
alter table [table name] drop [column name]

同时修改多列:
update [table name] set [column1]=[value1], [column2]=[value2] where ...... 

DerbyDB创建自增字段:
CREATE TABLE MAPS
(
MAP_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
MAP_NAME VARCHAR(24) NOT NULL,
REGION VARCHAR(26),
AREA DECIMAL(8,4) NOT NULL,
PHOTO_FORMAT VARCHAR(26) NOT NULL,
PICTURE BLOB(102400),
UNIQUE (MAP_ID, MAP_NAME)
)
BCP命令:
bcp {db_name}.dbo.{tablename} out {filename}.bcp -I{interface_name} -S{db_name_in_interface} -U{user_name} -P{password} -c -t"|" -Y
bcp {db_name}.dbo.{tablename} in {filename}.bcp -I{interface_name} -S{db_name_in_interface} -U{user_name} -P{password} -c -t"|" -Y
Interface definition:
{db_name_in_interface}
        master tcp ether {db_server_name} {port}
        query tcp ether {db_server_name} {port}

上一篇:Javascript 返回上一页并刷新


下一篇:阿里计划或花30亿元收购中兴软创,助力云计算服务的扩张