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 开发者_C百科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.
Assign an alias to the inner query:
SELECT
*
FROM
(SELECT * FROM Client) AS i
Try this:
SELECT * FROM
(
SELECT * FROM Client
)A;
Why don't you just
SELECT * FROM Client
and
SELECT TOP 1000 * FROM Client
if you want to limit the number of rows returned
If your query is more complicated you could use a common table expression
精彩评论