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?
This works fine
Tools -> Options -> Tables/Queries -> (At the bottom right:) Sql Server Compatible Syntax - turn option on for this database.
is not found on MS Access 2010
You may find Sql Server Compatible Syntax is already turned on, so definately worth just trying to run the sql statement mentioned above (via an ADO connection from ASP) before resorting to taking the db offline. Thanks, this helped me out.
With ADO, you can execute a DDL statement to create a field and set its default value.
CurrentProject.Connection.Execute _
"ALTER TABLE discardme ADD COLUMN membersOnly SHORT DEFAULT 0"
How are you connecting to the database to run the update SQL? You can use the ODBC compatible mode through ADO. Without opening the database in Access.
Tools -> Options -> Tables/Queries -> (At the bottom right:) Sql Server Compatible Syntax - turn option on for this database.
then you can execute your query:
ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0