看板 Database 關於我們 聯絡資訊
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'呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.232.34.180 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Database/M.1566557063.A.141.html
qw5526259: 謝謝!星期一上班才有資料庫可以測 08/23 22:19
qw5526259: 執行後,不成功。請問t1是什麼意思呢? 08/26 22:50
cutekid: 不成功的畫面截一下 08/27 02:53
mathrew: t1 是 table as t1 的意思,不成功,你該不會 table 前 08/28 06:55
mathrew: 真的加 # 符號? 08/28 06:55
qw5526259: 好的,我試一下,沒#符號 08/28 07:49