Re: [SQL ] 如何在MS SQL Server复制一笔资料

楼主: cutekid (可爱小孩子)   2019-08-23 18:44:21
select * into #tmp
from 资料表
where 身分字号字段名='A123456789'
update t1
set 身分字号字段名='Bxxxxxxxxxx'
from #tmp t1
insert into 资料表 select * from #tmp
※ 引述《qw5526259 (B.K)》之铭言:
: 数据库名称:MS SQL Server 2000
: 数据库版本:2000
: 内容/问题描述:
: 假设下面语法找到一笔资料
: Select * from 资料表 where 身分字号字段名='A123456789'
: 如何在相同的资料表下新增此笔资料
: 只改身分字号字段名='Bxxxxxxxxxx'呢?
作者: qw5526259 (缤纷乐)   2019-08-23 22:19:00
谢谢!星期一上班才有数据库可以测
楼主: cutekid (可爱小孩子)   2019-08-27 02:53:00
不成功的画面截一下
作者: mathrew (Joey)   2019-08-28 06:55:00
t1 是 table as t1 的意思,不成功,你该不会 table 前真的加 # 符号?
作者: qw5526259 (缤纷乐)   2019-08-28 07:49:00
好的,我试一下,没#符号

Links booklink

Contact Us: admin [ a t ] ucptt.com