sql语句复制一条记录并修改其中某个字段

2024-12-04 15:38:28
推荐回答(2个)
回答1:

insert into NB_kfq_zs (shi,kfq,kfqtype,nian,mon) select shi,kfq,kfqtype,nian,Convert(varchar(7),getdate(),120) from NB_kfq_zs

插入格式是:2010-07这样的

那就更简单了
insert into NB_kfq_zs (shi,kfq,kfqtype,nian,mon) select shi,kfq,kfqtype,nian,Month(getdate()) from NB_kfq_zs

回答2:

update NB_kfq_zs set mon='新值' where 查询条件