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
ALTER TABLE documents ADD COLUMN membersOnly NUMBER
I want this to work:
ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0
Have googled and seen instructions for default values work for other field types but I want to add number. Thanks!
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
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With