For Programmers: Free Programming Magazines  


Home > Archive > Clarion > August 2006 > SQL datetime









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL datetime
Jeremy

2006-08-25, 6:55 pm

I have a table with the date and time stored in two seperate fields as
integers (Clarion style). I would like a SQL command to update a third
field in the table which is a datetime with the SQL datetime value of
the first two fields. I would imagine that someone has done this by
now??

Jeremy Herron

Joseph Eveleigh

2006-08-28, 6:55 pm

Jeremy wrote:
> I have a table with the date and time stored in two seperate fields as
> integers (Clarion style). I would like a SQL command to update a third
> field in the table which is a datetime with the SQL datetime value of
> the first two fields. I would imagine that someone has done this by
> now??
>
> Jeremy Herron



Hi Jerry,

The combination of the following 2 queries should work. Haven't tested
it properly, so please run it on a test dataset first.

Update theTable
Set theSqlDateField = DateAdd(day, theClarionDate - 4, '1801-01-01')

Update theTable
Set theSqlDateField = DateAdd(ms, theClarionTime * 10, SqlDate)

Jeremy

2006-08-28, 6:55 pm

Joseph,

I don't know why I had it stuck in my mind that I needed to do this in
one statement, but it works great. Thanks

Jeremy



Joseph Eveleigh wrote:
> Jeremy wrote:
>
>
> Hi Jerry,
>
> The combination of the following 2 queries should work. Haven't tested
> it properly, so please run it on a test dataset first.
>
> Update theTable
> Set theSqlDateField = DateAdd(day, theClarionDate - 4, '1801-01-01')
>
> Update theTable
> Set theSqlDateField = DateAdd(ms, theClarionTime * 10, SqlDate)


Joseph Eveleigh

2006-08-29, 6:55 pm

Pleasure

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com