Jump to content

Field Format problem


murfitUK

Recommended Posts

I have an Excel spreadsheet. One of the columns is headed "LENGTH" and stores the length of a song. The column is formatted using Time 13:30:55 in the number tab of the format cells box.I couldn't find a way of importing this data into a mysql database so tried the mysqlMigrationTool from php.net. Using the migration tool I could only find a way of migrating an Access database so converted the Excel sheet into Access using the "Convert to MS Access" in Excel.This seemed to work well except that the LENGTH field is formatted as text and a value of eg 00:04:30 (four and a half minutes) now appears as 0.003125 in Access.If I try to amend the data type of the field in Access to a time format it gives an error "...encountered errors while converting data ... 10008 fields will be deleted. Proceed?" I answer No to this!When I use the migration tool everything goes OK.The LENGTH field in the sql database now has type varchar(255) and displays as eg 0.003125.I have tried changing the type to TIME but the results all show 00:00:00.I would like to get it to display in the 00:04:30 format again but I don't know how. Not sure if the solution lies somewhere in 1) the initial Excel sheet, 2) in converting from Excel to Access, 3) in Access once the database has been created, 4) in the conversion process using the Migration Tool or 5) in the sql database.Would be grateful for any suggestions. Thanks.

Link to comment
Share on other sites

  • 1 month later...

This is a fix for the Access import stage you're using:

  1. In Excel, save the worksheet as a CSV file
  2. In Access, import the CSV file

With this two-hop approach, Access recognizes the data as being of type date/time.I haven't used mysql, but from what you say, the above should enable your approach to work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...