|
date: Fri, 25 Oct 2024 10:31:35 -0700
from: Peter Dow <petercdow@xxxxxxxxx>
subject: Re: Implicit cast on ORDER BY
Hi Justin,
Like Rob, I'm curious why this is necessary:
order by case when :H <> :H
then NumericCol --decimal(7) TableA
else CharCol end ; --char(6) TableA
Since :H will never be unequal to :H, it's apparent you only want to use
CharCol as the sort key.
If it's a design requirement, I would think there should be a way to
actually select the sort order, something like
order by case when :H = 'numeric'
then NumericCol --decimal(7) TableA
else CharCol end ; --char(6) TableA
If you just want to document the choices you could simply make one of
them a comment
order by
-- NumericCol --decimal(7) TableA
CharCol; --char(6) TableA
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx /
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.