Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1149
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Erland Sommarskog <esquel@sommarskog.se> |
| Newsgroups | comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming |
| Subject | Re: Puzzling ORDER BY |
| Followup-To | comp.databases.ms-sqlserver |
| Date | Fri, 22 Jun 2012 11:31:08 +0200 |
| Organization | Erland Sommarskog |
| Lines | 21 |
| Message-ID | <XnsA07A752DCF965Yazorman@127.0.0.1> (permalink) |
| References | <t5j6u7l37h8sn1qieugouq6k0v78kbtbv0@4ax.com> <4fe3713b$0$6908$e4fe514c@news2.news.xs4all.nl> <bd17u7lv72v3aud4hefa4bmp437t90svmv@4ax.com> <4fe40fa8$0$6962$e4fe514c@news2.news.xs4all.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="7099"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mpzPQPT+2OJpxx23kkYFY" |
| User-Agent | Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) |
| Cancel-Lock | sha1:4O6Et44yLXmxVYriRoc7FuczjBo= |
| Xref | csiph.com comp.databases.ms-sqlserver:1149 |
Cross-posted to 2 groups.
Followups directed to: comp.databases.ms-sqlserver
Show key headers only | View raw
Jeroen Mostert (jmostert@xs4all.nl) writes: > Yes, you're right -- if you supply a constant expression explicitly, SQL > Server will catch this and flag it as nonsensical. A bit overzealous, I > think. It's mostly harmless, compared to other things that aren't > detected. > > If you use "NULL + [column]", or any other expression that always yields > NULL but isn't constant, the error goes away. The CASE, of course, is > not a constant expression. Or you can say ORDER BY (SELECT NULL). Which is not very useful in the main ORDER BY for a query, but this is useful with row_number() when you don't care about the order. (ORDER BY is mandatory for row_number.) -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
Puzzling ORDER BY Gene Wirchenko <genew@ocis.net> - 2012-06-21 09:37 -0700
Re: Puzzling ORDER BY Jeroen Mostert <jmostert@xs4all.nl> - 2012-06-21 21:08 +0200
Re: Puzzling ORDER BY Gene Wirchenko <genew@ocis.net> - 2012-06-21 13:40 -0700
Re: Puzzling ORDER BY Jeroen Mostert <jmostert@xs4all.nl> - 2012-06-22 08:24 +0200
Re: Puzzling ORDER BY Erland Sommarskog <esquel@sommarskog.se> - 2012-06-22 11:31 +0200
Re: Puzzling ORDER BY Erland Sommarskog <esquel@sommarskog.se> - 2012-06-21 23:31 +0200
Re: Puzzling ORDER BY Jeroen Mostert <jmostert@xs4all.nl> - 2012-06-22 08:46 +0200
Re: Puzzling ORDER BY rja.carnegie@gmail.com - 2012-07-02 03:36 -0700
csiph-web