Skip to Content.
Sympa Menu

freetds - Re: CONVERT and MSSQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Winkless, Geoff" <geoff.winkless AT pera.com>
  • To: 'TDS Development Group' <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: CONVERT and MSSQL
  • Date: Mon, 11 Mar 2002 16:48:59 -0000


I wrote:
> However the whole point was that although there may well be
> -better- ways of
> checking a year/date combination, the LIKE '2001-03%' example
> shown -should-
> work, and it'd be interesting to see why it doesn't.

And of course Simon Matthews hinted at this: force the CONVERT() function to
use the ISO date format using the optional STYLE parameter (position 3)

so

WHERE CONVERT (varchar(20), column_name, 121) LIKE '%2001-03-%'

works exactly as expected (although of course is not recommended for the
reasons already discussed!)

Further values for the STYLE parameter can be found in the TSQL
documentation.

Geoff




Archive powered by MHonArc 2.6.24.

Top of Page