|
 |
sql_language thread: Date in SQL Query
Message #1 by jean-francois.pillonel@m... on Fri, 10 May 2002 15:01:23
|
|
Jean-Francois
I aggree with Mister Cameron
You could also look at the REVERSE,YEAR,MONTH and DAY functions in BOL
But in the long term it would be better to fix it.
Justify your argument with this maxim:
"We always have time and money to fix it numerous times, but never enough
time and money to get it right the first time!!"
Good luck Mons
Greg Frazer
> This message is in MIME format. Since your mail reader does not
understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1FA0B.EED909B0
Content-Type: text/plain
> On my tables the dates are stored like that :
>
> 12 Oktober 2001 = 1002879134
That is the wrong way to store dates. Try using SQL Server's native date
and
smalldate format. The reason is you get access to a rich group of date
functions that let you handle just about anything to do with dates. One of
these is CONVERT that allows you to return a string that represents the
date
formatted into a specified format, eg US or international.
If you are locking into using this date format then you have problems. The
only thing you can do is to do some string manipulation. Look into LEFT,
RIGHT, LEN etc in SQL Books Online.
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: jean-francois.pillonel@m...
[mailto:jean-francois.pillonel@m...]
Sent: Saturday, 11 May 2002 1:01 AM
To: sql language
Subject: [sql_language] Date in SQL Query
Hello,
I have got a little problem with an SQL database on SQL server 2000.
On my tables the dates are stored like that :
12 Oktober 2001 = 1002879134
How to do a query with a american date ?
How to show a result of a select command with a correct format ?
Than you
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to
------_=_NextPart_001_01C1FA0B.EED909B0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [sql_language] Date in SQL Query</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>> On my tables the dates are stored like that =
:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 12 Oktober 2001 =3D 1002879134</FONT>
</P>
<P><FONT SIZE=3D2>That is the wrong way to store dates. Try using SQL =
Server's native date and smalldate format. The reason is you get access =
to a rich group of date functions that let you handle just about =
anything to do with dates. One of these is CONVERT that allows you to =
return a string that represents the date formatted into a specified =
format, eg US or international.</FONT></P>
<P><FONT SIZE=3D2>If you are locking into using this date format then =
you have problems. The only thing you can do is to do some string =
manipulation. Look into LEFT, RIGHT, LEN etc in SQL Books =
Online.</FONT></P>
<P><FONT SIZE=3D2>regards</FONT>
<BR><FONT SIZE=3D2>David Cameron</FONT>
<BR><FONT SIZE=3D2>nOw.b2b</FONT>
<BR><FONT SIZE=3D2>dcameron@i...</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: jean-francois.pillonel@m...</FONT>
<BR><FONT SIZE=3D2>[<A =
HREF=3D"mailto:jean-francois.pillonel@m...">mailto:jean-franc=
ois.pillonel@m...</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Saturday, 11 May 2002 1:01 AM</FONT>
<BR><FONT SIZE=3D2>To: sql language</FONT>
<BR><FONT SIZE=3D2>Subject: [sql_language] Date in SQL Query</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Hello,</FONT>
</P>
<P><FONT SIZE=3D2>I have got a little problem with an SQL database on =
SQL server 2000.</FONT>
</P>
<P><FONT SIZE=3D2>On my tables the dates are stored like that :</FONT>
</P>
<P><FONT SIZE=3D2>12 Oktober 2001 =3D 1002879134</FONT>
</P>
<P><FONT SIZE=3D2>How to do a query with a american date ?</FONT>
</P>
<P><FONT SIZE=3D2>How to show a result of a select command with a =
correct format ?</FONT>
</P>
<P><FONT SIZE=3D2>Than you</FONT>
<BR><FONT SIZE=3D2>---</FONT>
<BR><FONT SIZE=3D2>Change your mail options at <A =
HREF=3D"http://p2p.wrox.com/manager.asp" =
TARGET=3D"_blank">http://p2p.wrox.com/manager.asp</A> or </FONT>
<BR><FONT SIZE=3D2>to unsubscribe send a blank email to =
</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C1FA0B.EED909B0--
|
|
 |