SQL to add a default column - Access 2003

Updating an old ASP / Access site for a client - I need SQL to add a column to an existing table and set a default value. Doesn't work - any ideas?

It works great

ALTER TABLE documents ADD COLUMN membersOnly NUMBER

I want this to work:

ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0

I have googled and the seen instructions for default values โ€‹โ€‹work for other types of fields, but I want to add a number. Thanks!

+5
source share
5 answers

Tools โ†’ Options โ†’ Tables / Queries โ†’ (In the lower right corner: Sql Server Compatible Syntax - enable this database for this database.

then you can fulfill your request:

ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0
+8
source

ADO DDL .

CurrentProject.Connection.Execute _
   "ALTER TABLE discardme ADD COLUMN membersOnly SHORT DEFAULT 0"
+6

SQL- ? ODBC ADO. Access.

0

You may find that the Sql Server Compatible Syntax syntax is already enabled, so just try to run the sql statement mentioned above (via an ADO connection from ASP) before proceeding with disabling db. Thanks, that helped me.

0
source

Tools โ†’ Options โ†’ Tables / Queries โ†’ (Bottom right :) Sql Server Compatible Syntax Syntax - enable this database for this database.

not found on MS Access 2010

0
source

All Articles