奇怪的要求分号

时间:2013-10-27 22:09:42

标签: sql

我正在尝试对表创建语句进行更新,但遇到以下错误: Msg 102,Level 15,State 1,Line 15 ';'附近的语法不正确。

任何指针都将不胜感激。

IF EXISTS(SELECT * FROM .information_schema.tables WHERE table_name = 'DeviceDashboard')
BEGIN
    DROP TABLE dbo.DeviceDashboard
END

SELECT * INTO DeviceDashboard
FROM
(
select
b.*, sm.sector
from RPT_DeviceDashboard b
left outer join  sectormapping sm
on b.industry = sm.industry
);

1 个答案:

答案 0 :(得分:4)

您可能必须为子选择提供表别名。

...
  on b.industry = sm.industry
) AS T;