使用子句导致数据库兼容模式错误

时间:2015-05-04 11:31:16

标签: sql sql-server

我正在尝试使用"加入"运营商和"使用"条款,以避免使用"自然加入"但不知怎的,我总是得到以下错误:

  

" SID"不是可识别的表提示选项。如果它是作为一个   表值函数或CHANGETABLE函数的参数,   确保您的数据库兼容模式设置为90。

查询我使用的是:

select sName, GPA
from Student join Apply using (sID)
where sizeHS < 1000 and major = 'CS' and cName = 'Stanford';

两个Tabels包含的列是&#34; sID&#34;。

兼容性在90/100/110上有所改变,但没有修复我的问题。为了确保我正确地改变了我使用的兼容性模式:

SELECT compatibility_level 
FROM sys.databases
WHERE name = 'databasePath'

1 个答案:

答案 0 :(得分:2)

您可以using (sID)使用oracle而不是sql server。对于sql server,您必须以这种方式使用连接

select sName, GPA
from Student 
join Apply on Apply.sID = Student.sID 
where sizeHS < 1000 and major = 'CS' and cName = 'Stanford';