0
所以我將插入語句轉換爲更新語句。轉換tsql插入更新是否正確?
這裏是插入
insert into Matches(
SourceID,
SourceUniqueID,
ExtractionNumber,
ItemID,
MatchDate,
MatchBy,
MatchMethod)
select
m.SourceID
,m.SourceUniqueID
,m.ExtractionNumber
,m.ExtractionNumber
,getdate()
,replace(suser_sname(),'Bob\','')
,'EMTransmittalnumber'
from MatchData as m
where m.SourceID = 19
這裏是更新語句我有這麼遠,但它產生錯誤
update m2 set
m2.SourceID = m.SourceID
, m2.SourceUniqueID = m.SourceUniqueID
, m2.ExtractionNumber = m.ExtractionNumber
, m2.ItemID = m.ExtractionNumber
, m2.MatchDate = getdate()
, m2.MatchBy = replace(suser_sname(),'Bob\','')
, m2.MatchMethod = 'EMTransmittalnumber'
from MatchData as m
inner join Matches as m2
m2.itemid = m.extractionnumber
where m.sourceid = 19
錯誤表示不正確的語法附近「M2」
任何想法?