Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using TOP with ORDER BY Clause

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-07 : 11:04:29
John writes "I am trying to create a view that I need to sort it using the ORDER BY clause and save it. When I just run it to view it it displays an error saying incorrect syntax using order by but it displays the results. When I try to save the view another error message pops up saying I need to use TOP with the ORDER BY CLAUSE. I found an example of this on microsofts web site and I copied it exacty except with the fields I need. when I do this I get a different error and I cannot save the view. My querry is attached below (I've stripped out other tables that I joined to make it as simple as possible and it still doesn't work). Any suggestions??

SELECT TOP *
FROM isbn
ORDER BY i.isbn"

macka
Posting Yak Master

162 Posts

Posted - 2002-05-07 : 11:07:08
Give this a go:

SELECT TOP 100 PERCENT *
FROM isbn
ORDER BY isbn.isbn



Edited by - macka on 05/07/2002 11:08:40
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-05-07 : 11:57:56
Post your actual Query

SELECT TOP *
FROM isbn
ORDER BY [givecolumnnameshere]

eg:

select top * from
authors
order by Authorid




--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -