Jet SQL, ADD COLUMN columnName BIT DEFAULT "0"

GolferGuy

Registered User.
Local time
Today, 09:18
Joined
Nov 5, 2007
Messages
175
I am trying to set a default to a new Yes/No field to 0/False in code. I can not find the syntax that will work for a BIT data type. I have tried everything I can think of, plus I can not find any documentation for Jet SQL. Any Ideas?
So far I have tried this statement:
ALTER TABLE tblProperty ADD COLUMN Dropped bit DEFAULT 0;
withe these variations for the default value:
(0); ((0)); FALSE; false; False; '0'; "0"
None of these have worked.
 
hmmm, other than it defaulting to 0 anyway I can't say I've had a great deal of luck trying this programatically so far and I'm running out of time to try anything more complicated for a couple of hours, but it's bugging me now so I'll have another look at it when I get home.

The MS documentation does suggest that you can't do this using SQL view from the query designer, but I've not managed to coax it to work either way:
Microsoft said:
The DEFAULT statement can be executed only through the Jet OLE DB provider and ADO. It will return an error message if used through the Access SQL View user interface.
 
Last edited:
Thank you very much. It works great! Even though the Access table does not show that 0 is the default, the field itself has a 0 in it after it is added to the table. Thank you!
 

Users who are viewing this thread

Back
Top Bottom