我有两个表,一个名为issue,另一个在SQL Server 2008中名为activ。我正在删除有问题的列,但在此之前,我想在activ中找到相应的列,并更新一个字段。我只是不确定如何引用激活。
issue
iissueid, iactivid, ...
activ
iactivid, rtfnotes, ...
UPDATE activ
SET activ.rtfnotes = NULL
FROM issue
JOIN activ.iactivid = issue.iactivid
WHERE issue.iissueid = @tID
DELETE issue WHERE iissueid = @tID
有人可以指出我哪里出错了。我很确定我差不多了。
答案 0 :(得分:0)
UPDATE a
SET a.rtfnotes = NULL
FROM activ a
JOIN issue i ON a.iactivid = i.iactivid AND i.iissueid = @tID
DELETE issue WHERE iissueid = @tID