|
|
 |
Re: FN-FORUM: sql question
date posted 8th August 2004 10:03
Thanks Andy - that is what I am looking for but I could find the definition
anywhere.
Pam
----- Original Message -----
From: "Andy Macnaughton-Jones" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Saturday, August 07, 2004 2:37 PM
Subject: RE: FN-FORUM: sql question
>
> For SQL Server;
>
> Convert(datetime, datefield, 3)
>
> If you're using YYYY then use 103
>
> Converts your text into date format.
>
> I always pass my dates in and out of stored procedures using varchars as
> DD/MM/YYYY
>
> Then convert the varchar into datetime fields in the stored procedure.
>
> Cheers
> Andy
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Andy
> Stafford
> Sent: Saturday, August 07, 2004 1:18 PM
> To: Andy Macnaughton-Jones
> Subject: Re: FN-FORUM: sql question
>
>
> PAMELA WHITTAKER wrote:
>
> > I have a date stored as dd/mm/yy as a vchar in an sql database. How do
>
> > I write an sql statement to select a date range? Is there some way of
> > converting it to a date format in the select statement?
>
> If it is MSSQL, you could try
>
> http://msdn.microsoft.com/library/en-us/tsqlref/ts_ca-co_2f3o.asp
>
> or use SUBSTRING
>
> substring(datefield,7,2) + substring(datefield,4,2) +
> substring(datefield,1,2)
>
> Either way is going to be innefficient compared to just converting them
> to date data type, the second way will land you in prison.
>
>
> --
> http://www.dandylogic.com
>
>
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
> Unsub: http://www.freelancers.net/rm.php?g-3C1A3555B6A0E8759F
>
> To Post a New Message: [EMAIL REMOVED]
> Forum Homepage: http://www.freelancers.net/forum.php
>
> http://www.freelancers.net - freelancers and freelance jobs
>
>
|
 |
|