Help with ALTER Table syntax

J

Jake

Hello,

I have a column in a table that I want to alter and add a deault value.
Can someone please give me an example of this using the SQL syntax for
access. Thanks in advance.

Table: Table1
Column 1: PKColumn (number)
Column 2: Column2 (text)

Would like to change column2 to have a default value of "This is a test"
 
G

GVaught

Assuming you are working with Access 2000 or higher. The syntax is:

New table:
ALTER TABLE tablename ALTER [Column] column datatype[size]
[DEFAULT default-value] [CONSTRAINT] single-column-constraint];


existing table:
ALTER TABLE tblNewItems ALTER ItemID SET Default "1001";
 
J

Jake

G Vaught,

Thanks for the info.

Jake


GVaught said:
Assuming you are working with Access 2000 or higher. The syntax is:

New table:
ALTER TABLE tablename ALTER [Column] column datatype[size]
[DEFAULT default-value] [CONSTRAINT] single-column-constraint];


existing table:
ALTER TABLE tblNewItems ALTER ItemID SET Default "1001";

--
G Vaught


Jake said:
Hello,

I have a column in a table that I want to alter and add a deault value.
Can someone please give me an example of this using the SQL syntax for
access. Thanks in advance.

Table: Table1
Column 1: PKColumn (number)
Column 2: Column2 (text)

Would like to change column2 to have a default value of "This is a test"
 
J

Jake

G Vaught,

I couldn't get any of those statements to work in the query interface of
access. We are using access 2003. I basically have a table with an ID and a
column called notes. How can I set the default value of the notes column to
something like "this is a test". I then also want to add an updated column
with a default value of the current system date. Any help would be greatly
appreciated.

Jake

GVaught said:
Assuming you are working with Access 2000 or higher. The syntax is:

New table:
ALTER TABLE tablename ALTER [Column] column datatype[size]
[DEFAULT default-value] [CONSTRAINT] single-column-constraint];


existing table:
ALTER TABLE tblNewItems ALTER ItemID SET Default "1001";

--
G Vaught


Jake said:
Hello,

I have a column in a table that I want to alter and add a deault value.
Can someone please give me an example of this using the SQL syntax for
access. Thanks in advance.

Table: Table1
Column 1: PKColumn (number)
Column 2: Column2 (text)

Would like to change column2 to have a default value of "This is a test"
 
V

Van T. Dinh

IIRC, you need to execute the SQL String using ADO code.

The Access Query interface does not support a number of new syntaxes
introduced in JET 4.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top