Re: Sort database alphabetically
From: Gert-Jan Strik (sorry_at_toomuchspamalready.nl)
Date: 11/26/04
- Next message: tim: "Re: Database marked as suspect when bringing up a clustered server"
- Previous message: David Portas: "Re: SQL Slower than MS Access when using ctrl+f to search fields o"
- In reply to: Jeff: "Re: Sort database alphabetically"
- Next in thread: David Portas: "Re: Sort database alphabetically"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 26 Nov 2004 19:57:20 +0100
Jeff,
The only way to guarantee sorted output is by specifying an ORDER BY
clause.
What I am saying is that you cannot sort the database, and even if you
could, it would be useless, because the order of the resultset can only
be specified by the query.
So all you need to do is add "ORDER BY Name" to your existing query.
Hope this helps,
Gert-Jan
Jeff wrote:
>
> Yes, what I'd like to do is have the table in a known order so that as a web
> based query is performed on the database the results are already in the
> order they should be displayed (alphabetically based on a column of
> surnames). Currently the database is not sorted in the order I'd like. I
> know almost nothing about enterprise manager and SQL so I was wondering how
> to accomplish this task.
>
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
> news:42543446-C493-45A1-8513-9967D1229A24@microsoft.com...
> > I assume you mean you want to sort a specific table rather than a
> database.
> > What you should do is sort the result when you *query* the table. In
> > Enterprise Manager right -click on the table name and choose Open Table >
> > Query. In the Query Designer screen use the Sort Order column to specify
> how
> > you want the result sorted.
> >
> > A database table is logically unsorted. Although you can create indexes
> > which hold data in a known order for the purposes of query optimization,
> this
> > is NOT the same as sorting the actual result of a query. What I understand
> > you to mean by your question is that you want to see the result sorted on
> > screen. To do this you always need to specify the sort order in a query,
> for
> > example using EM's Query Designer or using an ORDER BY clause in
> Transact-SQL.
> >
> > Hope this helps.
> >
> > --
> > David Portas
> > SQL Server MVP
> > --
> >
> >
> > "Jeff" wrote:
> >
> > > I'm new to sql server and have a large database with four columns that I
> > > would like to sort alphabetically in ascending order based on a column
> of
> > > names (column is called Name). Could someone advise me how I can use
> > > enterprise manager to sort the database?
> > > Jeff
> > >
> > >
> > >
- Next message: tim: "Re: Database marked as suspect when bringing up a clustered server"
- Previous message: David Portas: "Re: SQL Slower than MS Access when using ctrl+f to search fields o"
- In reply to: Jeff: "Re: Sort database alphabetically"
- Next in thread: David Portas: "Re: Sort database alphabetically"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|