Alter Column Definition

jeancake

Board Regular
Joined
Nov 3, 2008
Messages
57
Does anyone know the Alter Column command to change a Table Column definition from a character to a "Yes/NO" field?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The general code to modify the datatype of a column is this.

ALTER TABLE table_name
MODIFY COLUMN column_name datatype

However I'm not sure if it's possible to use SQL in Access for what you want to do, you might need to alter the column via the table's TableDef.
 
Upvote 0
I've been able to use it in access using SQL to change other data types (# to currency , etc) but I don't know what the datatype name for 'Yes/No' is.
 
Upvote 0
That's kind of the problem, I think the Yes/No datatype isn't a 'standard SQL' datatype.

Mind you I think I saw some sort of workabout earlier, I'll have another look.
 
Upvote 0
The type is Boolean (data type number is 1)
try "ALTER TABLE tblName ALTER COLUMN fieldName YesNo"
If you want to format it as other than Yes/No (True/False, On/Off) , I think you will have to use DAO.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,014
Messages
6,122,697
Members
449,092
Latest member
snoom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top