Saturday, February 11, 2012

"Converting numbers into Dates"

I'm working in Access 2000. I was given some tables with number (long integer) data types for dates, such as 20041011 for Oct. 11, 2004. How can I convert these rows of numbers into dates? in order to re-format the table to accept them as dates?

I prefer to do this within the sql statement (update query, etc). What is the sql syntax to do this? (assume the column name is Notdate). Thanks!!!For Access you can do it like this

UPDATE Tablename
SET [NotDate] = DateSerial(Int(Left([notDate],4)),Int(Left(Right([NotDate],4),2)),INT(Right([NotDate],2)));|||It seems a better idea to me to create a second column D with datatype Date to store the result in:

UPDATE tablename SET D = DateSerial(...

No comments:

Post a Comment