Changing the default value of a column in Access using a SQL query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a VC++ Windows application that uses an Access database as a
backend. I need a way to change the default value of a column using a SQL
query.

I have tried

ALTER TABLE <table_name> ALTER COLUMN <column_name> SET DEFAULT <value>

however, I get 'Syntax error in ALTER TABLE statement' and the keyword
DEFAULT is highlighted.

I have also tried

ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> DEFAULT <value>
FOR <column_name>

however, I get 'Syntax error in CONSTRAINT clause' and the keyword DEFAULT
is highlighted.

I am really hoping there's a way to do this. Any help would be appreciated.

Thanks,
Alan Arsinow
 
According to the online Help I don;t think you can do it. Here's the
extract. Note it does not mention "SET DEFAULT"

Use ALTER COLUMN to change the data type of an existing field. You specify
the field name, the new data type, and an optional size for Text and Binary
fields. For example, the following statement changes the data type of a
field in the Employees table called ZipCode (originally defined as Integer)
to a 10-character Text field:
 
Back
Top