You are here: Re: ORDER BY in VIEW not working « MsSQL Server « IT news, forums, messages
Re: ORDER BY in VIEW not working

Posted by Beowulf on 01/26/06 16:50

--CELKO-- wrote:
> Someone was asleep in their RDBMS class! What is the most basic
> property of a Table? It has no ordering by definition. To get an
> ordering, you have to have a cursor.

Tables are unordered, but a view's not a table, as far as I understand
it. It is a stored pre-compiled select statement that allows you to
view table data the way you want. Coming from Acess, I expect to be
able to have views be ordered if I include an ORDER BY clause. As it
turns out, I can't expect that from SQL Server. Now I know.

> T-SQL dialect is simply forgiving about the extra clause. What can
> happen, however, is that when indexing or stats change, you will force
> a needlessly expensive sort in queires using this VIEW under the
> covers.

Good to know. Thanks for the information.

> Also, why did you have SELECT TOP 100 PERCENT instead of a plain old
> SELECT?

If you are as knowledgeable about T-SQL as you're representing then you
know exactly why I had to use SELECT TOP 100 PERCENT.

> Next, stop putting those silly prefixes on data element names. They
> scream out "Newbie who doesn't know data modeling or SQL!" to the
> world. Then learn that names like "type", "class", "category", etc.
> are too vague to be data element names. They beg the question "of
> what??"

I don't see any problem at all with disambiguating the elements of my
select statement with the table name qualifier and I'm not going to stop
what I consider a good practice just because you think it is something
newbies do. Do you have a substantive reason for why I shouldn't be
explicit about where I'm selecting my data from?

I'd probably agree with you about the field names, but I'm not going to
completely rewrite this application because a handful of the field names
are bad. It was in production for over 3 years before I even started
working on it and as vague as you think the field names are, they have
to come to have definite meaning for the users of the application. So,
going through and renaming all the fields to "less vague" names would
take up my time, surely introduce bugs, and end up confusing the users.
Sadly, I have to develop this application in the real world, where
sometimes I have to put up with less than ideal code created by someone
else.

> Read a summary of ISO-11179 metadata rules for help.

Thanks for the reference. I'm going to look it up now.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация