Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2003, 10:54 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default change data type to date

can anyone teach me how to change the data type of a text field to a date/time field using SQL commands? i have thousands of records and i don't want to delete them..

 
Old July 29th, 2003, 09:52 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can anyone teach me? i have this microsoft access file with its date column changed to the datatype as text. i need to change it back without deleting any records.

 
Old July 29th, 2003, 10:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fairly simple thing:

Code:
ALTER TABLE TableName ALTER FieldName Date;
Another way to do it is to copy and paste the table, but copy the structure only, then change the fieldtype of the field in the new table, then make an append query.

Yet another way you can do it, is just go into the design view of the table and change it to Date straight away. This way does have its issues though - it seems to take forever, and if you have heaps of records, it will take longer than forever, assuming it doesn't crash your system.

Steven

I am a loud man with a very large hat. This means I am in charge





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data type change from int to Varchar getxyz SQL Server 2000 1 April 29th, 2005 09:59 AM
Getting Problem in DATE/TIME Data type in MS Acces selam70 Classic ASP Databases 2 September 4th, 2004 02:31 PM
data type for date in msde isheikh SQL Server ASP 1 March 9th, 2004 10:20 PM
Change data type to DATE in SQL kherboon SQL Server 2000 4 July 28th, 2003 10:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.