Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing fields

Status
Not open for further replies.

krill

Programmer
Jan 16, 2001
38
AU
Hi chaps....


Is there a way in "code" to change the data type of an existing field ..eg. a text field to a memo field in Microsoft Access 97. I don't want to muck around if I can with deleteing and appending new fields ..this database is aready active with real data.

 
Hi,

In Oracle there is an ALTER TABLE command, where you can

ALTER TABLE tabName modify colName NewDataType

I suppose in Access (it uses Microsoft Jet) it would be the same.

The syntax of ALTER TABLE is


ALTER TABLE table {ADD {COLUMN field type[(size)] [NOT NULL] [CONSTRAINT index] |
CONSTRAINT multifieldindex} |
DROP {COLUMN field I CONSTRAINT indexname} }
[b/]
I haven't heard of column modifying... but you never know, that Gates is something else...

Ciao
Phathi :)
 
If you are doing it in Access, why not use the access front end?

Create a new table that you want your old table to look like, then copy the data in. Then rename and viola.
 
I looked at he sql commands for altering tables..ad it seems to be only useful if you are deleting or adding columns..not changing the actual data type :( Also I can't use access because this app is run on over 60 machines nation wide and some of them don't even have access loaded. I was hoping to make a nice quick exe to "patch" the table structure...I probably can still do this but I will have to play around with creating temporary tables and deleting and adding columns...I was hoping there was a quick way. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top