WHILE @@ROWCOUNT <> 0
BEGIN
CHECKPOINT;
DELETE TOP (300000)
FROM [dbo].[Event] AS E
INNER JOIN #tempEvents AS TE
ON E.[EventID] = TE.[EventID]
END
首先,我得到:
Incorrect syntax near the keyword 'AS'.
所以,我删除了这个并用带有完整表名的别名替换,这给了我:
Incorrect syntax near the keyword 'INNER'.
我发现了question这是我发现INNER JOIN
的地方,但是SQL Server没有正确解析它。有什么想法吗?
答案 0 :(得分:3)
试试这个:
WHILE @@ROWCOUNT <> 0
BEGIN
CHECKPOINT;
DELETE TOP (300000) E
FROM [dbo].[Event] AS E
INNER JOIN #tempEvents AS TE
ON E.[EventID] = TE.[EventID]
END
你错过了top语句后的tablename / alias。