Home > Archive > MS SQL Server > July 2005 > TOP CLAUSE not working in queries and views









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author TOP CLAUSE not working in queries and views
John Cosmas

2005-07-30, 8:23 pm

I had to convert a database from VFP into SQL 2000. I have a primary key I
have added, plus I have properly indexed the table as well. Unfortunately,
I cannot create a query that supports the TOP clause. SQL Server keeps
returning "Incorrect syntax near '100'" The user DBO has permissions to
everything. I have created a view in another database on the same server
and it seems to respond correctly.


Mike Epprecht \(SQL MVP\)

2005-07-30, 8:23 pm

SELECT
TOP 100 PERCENT
*
FROM
TableA

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"John Cosmas" <johncosmas@charter.net> wrote in message
news:zAVGe.2526$5B2.990@fe04.lga...
>I had to convert a database from VFP into SQL 2000. I have a primary key I
> have added, plus I have properly indexed the table as well.
> Unfortunately,
> I cannot create a query that supports the TOP clause. SQL Server keeps
> returning "Incorrect syntax near '100'" The user DBO has permissions to
> everything. I have created a view in another database on the same server
> and it seems to respond correctly.
>



Andrew J. Kelly

2005-07-31, 3:23 am

Check to be sure the server is not in 6.5 compatibility mode.

--
Andrew J. Kelly SQL MVP


"John Cosmas" <johncosmas@charter.net> wrote in message
news:zAVGe.2526$5B2.990@fe04.lga...
>I had to convert a database from VFP into SQL 2000. I have a primary key I
> have added, plus I have properly indexed the table as well.
> Unfortunately,
> I cannot create a query that supports the TOP clause. SQL Server keeps
> returning "Incorrect syntax near '100'" The user DBO has permissions to
> everything. I have created a view in another database on the same server
> and it seems to respond correctly.
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com