Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update date to the sql table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-05 : 10:59:07
Oren writes "Hi,

I have a date string : 'Thu Jan 2 00:00:00 UTC+0200 2003'
and I want to enter it to a datetime field in the sql.

I know I have to convert it but what kind of actions should I take in order to do that.

Thanks in advance,

Oren"

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-07-05 : 11:30:50
Well, if all the entries in the field are the same you could use right and left to get the values into something that sql can convert.

year = left(datestring,4)
month would be left(right(datestring,7),3)
day is left(right(datestring,9),1)

but this will only work if all those columns have the exact same number of digits in it.

Where is this number coming from? I would try to format it to something before it came to SQL if possible.

-----------------------
Take my advice, I dare ya
Go to Top of Page
   

- Advertisement -