SQL Server 2008 Mgmt Studio:使用子查询的任何内容附近的语法都不正确
我运行以下查询
SELECT * FROM
(
SELECT * FROM Client
);
,我应该获得客户端中所有字段的列表,而不是我
Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near ';'.
遇到的唯一原因是编写带有WITH子句的视图,它给了我同样的错误。在此之前,已卸载 SQL Server Management Studio 2005,并安装了 2008 Management Studio Express。
知道为什么我不能执行任何类型的子查询吗?使用 New Query 并通过从 Client 表中选择 TOP 1000 ROWS 尝试了此操作。
I run the following query
SELECT * FROM
(
SELECT * FROM Client
);
and I should get a list of all fields in client, instead I get
Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near ';'.
The only reason I've come across this was writing a view with a WITH clause and it gave me the same errors. Prior to this, SQL Server Management Studio 2005 was uninstalled, and 2008 Management Studio Express was installed in its place.
Any idea why I cannot do a subquery of any kind? Tried this with New Query and through SELECT TOP 1000 ROWS from Client table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为内部查询分配别名:
Assign an alias to the inner query:
试试这个:
Try this:
为什么不呢
?
如果您想限制返回的行数,
如果您的查询更复杂,您可以使用 公用表表达式
Why don't you just
and
if you want to limit the number of rows returned
If your query is more complicated you could use a common table expression