Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert default values in a column (access db)

How can I do for inserting a Default Value into a column of a table in Access? I use this instruction:

ALTER TABLE Tabella ADD Campo Double DEFAULT 0
ALTER TABLE Tabella ADD Campo Double DEFAULT (0)
ALTER TABLE Tabella ADD Campo DEFAULT 0
ALTER TABLE Tabella ADD Campo DEFAULT (0)
ALTER TABLE Tabella ADD Campo SET DEFAULT 0
ALTER TABLE Tabella ADD Campo SET DEFAULT (0)

but all of these cause error. How can I do for doing it?


2 Answers

From MSDN:

The DEFAULT statement can be executed only through the Access OLE DB provider and ADO. It will return an error message if used through the Access SQL View user interface.

Sooo... tell us more about what you're doing and how you're executing your SQL?

And why aren't you using the table designer?

like image 133
Kieveli Avatar answered Apr 22 '26 15:04

Kieveli


See this answer?

SQL to add column with default value - Access 2003

like image 26
Dan Vinton Avatar answered Apr 22 '26 17:04

Dan Vinton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!