我有一个访问数据库,但最近搬到了SQL服务器,我几乎修改了所有查询但是这个:
UPDATE Articulos_Auditoria
INNER JOIN Auditoria ON Articulos_Auditoria.CUD = Auditoria.CUD
SET Articulos_Auditoria.Cortado = 'True'
WHERE
(((CAST([Fecha] AS DATE)) = CAST(@Fecha AS DATE))
AND ((Auditoria.Terminal) = @term))
我正在尝试将其转换为SQL Server(因为我将DateValue
更改为CAST
)但是intellisense在“' INNER'
有人能给我一些见解吗?
答案 0 :(得分:1)
使用from
子句和表别名:
UPDATE aa
SET Cortado = 'True'
FROM Articulos_Auditoria aa INNER JOIN
Auditoria a
ON aa.CUD = a.CUD
WHERE CAST([Fecha] as date) = CAST(@Fecha as date) AND (a.Terminal = @term)
答案 1 :(得分:1)
您有两个错误:
您需要在SET
UPDATE TableName
您需要定义FROM
子句
UPDATE Articulos_Auditoria
SET Cortado = 'True'
FROM Articulos_Auditoria
INNER JOIN Auditoria
ON Articulos_Auditoria.CUD = Auditoria.CUD
WHERE CAST([Fecha] as date)=CAST(@Fecha as date)
AND Auditoria.Terminal=@term