Discussion:
Default Value for MS Access ALTER TABLE ADD COLUMN
Stan Winchester
2005-03-21 23:50:25 UTC
Permalink
Is there a way to add a default value with a MS Access ALTER TABLE ADD
COLUMN?



<CFQUERY NAME="AddSendEmail" DATASOURCE="#request.dsn#">

ALTER TABLE tbl_Users

ADD COLUMN SendEmail BIT default (1) NOT NULL

</CFQUERY>



I've tried it with and without the parentheses and it will not work.



I need to do this for a patch that must be applied online.



Thank you,

Aftershock Web Design, Inc.

by: Stan Winchester

President/Developer






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199619
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=13123.11886.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Dawson, Michael
2005-03-22 00:01:58 UTC
Permalink
I would alter the table to add a NULLable column. Then, set all values
to 1. Then, alter the table to make the column NOT NULL.

First, instead of (1), try (-1). I think Access stores bits as -1 or 0,
but I could be wrong...again.

M!ke

-----Original Message-----
From: Stan Winchester [mailto:stan-rRlE6bsUJf2lbIVvcxbkxQC/***@public.gmane.org]
Sent: Monday, March 21, 2005 5:50 PM
To: CF-Talk
Subject: Default Value for MS Access ALTER TABLE ADD COLUMN

Is there a way to add a default value with a MS Access ALTER TABLE ADD
COLUMN?



<CFQUERY NAME="AddSendEmail" DATASOURCE="#request.dsn#">

ALTER TABLE tbl_Users

ADD COLUMN SendEmail BIT default (1) NOT NULL

</CFQUERY>



I've tried it with and without the parentheses and it will not work.



I need to do this for a patch that must be applied online.



Thank you,

Aftershock Web Design, Inc.

by: Stan Winchester

President/Developer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199620
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=13123.11886.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Stan Winchester
2005-03-22 01:10:23 UTC
Permalink
So there is no way of setting a default value in an Access database using the ALTER statement like in SQL Server, MySQL ect...

It seems if it can be done in the Access "Design View" there should be a SQL equivalent.
Post by Dawson, Michael
I would alter the table to add a NULLable column. Then, set all values
to 1. Then, alter the table to make the column NOT NULL.
First, instead of (1), try (-1). I think Access stores bits as -1 or 0,
but I could be wrong...again.
If you enter 1 Access changes it to -1
Post by Dawson, Michael
M!ke
-----Original Message-----
Sent: Monday, March 21, 2005 5:50 PM
To: CF-Talk
Subject: Default Value for MS Access ALTER TABLE ADD COLUMN
Is there a way to add a default value with a MS Access ALTER TABLE ADD
COLUMN?
<CFQUERY NAME="AddSendEmail" DATASOURCE="#request.dsn#">
ALTER TABLE tbl_Users
ADD COLUMN SendEmail BIT default (1) NOT NULL
</CFQUERY>
I've tried it with and without the parentheses and it will not work.
I need to do this for a patch that must be applied online.
Thank you,
Aftershock Web Design, Inc.
by: Stan Winchester
President/Developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199624
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=13123.11886.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Thomas Chiverton
2005-03-23 14:01:17 UTC
Permalink
Post by Stan Winchester
It seems if it can be done in the Access "Design View" there should be a SQL equivalent.
Why ?
One thing knows all about the grubby internals of your specific database, and
the other is an open language standard.
--
Tom Chiverton
Advanced ColdFusion Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199750
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=13123.11886.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Continue reading on narkive:
Loading...