Sunday, March 25, 2012

Date problem

I have a simple query which returns records between specific dates however
it seems I have to use the mm/dd/yy method however im in the UK and we use
dd/mm/yy how can I get sql server to use the right one?
--
Regards
Gary Howlett
Systems Developer
www.rainbowgrp.co.ukJust ust the "yyyymmdd" format, it is independent of your current settings.
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Gary Howlett" <gary@.rainbowgrp.co.uk> wrote in message
news:QPI_a.3395$z7.558306@.wards.force9.net...
> I have a simple query which returns records between specific dates however
> it seems I have to use the mm/dd/yy method however im in the UK and we use
> dd/mm/yy how can I get sql server to use the right one?
> --
> Regards
> Gary Howlett
> Systems Developer
> www.rainbowgrp.co.uk
>|||Hi Gary,
The problem here is not SQL Server but the machine SQL
runs on.
You will need to change the local setting for that machine
to England (i.e. Pounds, dd/mm/yyyy ect) on that machine.
If its a case that you are remove connecting then you can
follow Dejan sugestion or use the 'style' option on a cast
or convert function (for further details see bol).
Peter
>--Original Message--
>I have a simple query which returns records between
specific dates however
>it seems I have to use the mm/dd/yy method however im in
the UK and we use
>dd/mm/yy how can I get sql server to use the right one?
>--
>Regards
>Gary Howlett
>Systems Developer
>www.rainbowgrp.co.uk
>
>.
>|||Use the ISO standard YYYYMMDD format when passing dates to SQL Server, then
there is no confusion no matter where you put your server, who messes with
regional settings, or what SET DATEFORMAT or SET LANGUAGE options have been
configured.
"Gary Howlett" <gary@.rainbowgrp.co.uk> wrote in message
news:QPI_a.3395$z7.558306@.wards.force9.net...
> I have a simple query which returns records between specific dates however
> it seems I have to use the mm/dd/yy method however im in the UK and we use
> dd/mm/yy how can I get sql server to use the right one?
> --
> Regards
> Gary Howlett
> Systems Developer
> www.rainbowgrp.co.uk
>

No comments:

Post a Comment