Info: ALTER TABLE DEFAULT error

J

Jamie Collins

Ever noticed this...? Sql code executed via ADO and OLEDB provider:

CREATE TABLE ATest (
MyIntCol1 INTEGER NULL,
MyIntCol2 INTEGER NOT NULL DEFAULT 0);

ALTER TABLE ATest DROP MyIntCol2;

ALTER TABLE ATest ADD MyIntCol2 INTEGER NOT NULL DEFAULT 0;

For the last statement I get an error, 'Syntax error in table-level
validation expression.'

However (note the space at the end):

ALTER TABLE ATest ADD MyIntCol2 INTEGER NOT NULL DEFAULT 0 ;

executes with no error!

Jamie.

--
 
J

Jamie Collins

Jamie wrote...
ALTER TABLE ATest ADD MyIntCol2 INTEGER NOT NULL DEFAULT 0;

For the last statement I get an error, 'Syntax error in table-level
validation expression.'

However (note the space at the end):

ALTER TABLE ATest ADD MyIntCol2 INTEGER NOT NULL DEFAULT 0 ;

executes with no error!

By chance I've since discovered that using standard sytax the ALTER TABLE would be:

ALTER TABLE ATest ADD MyIntCol2 INTEGER DEFAULT 0 NOT NULL;

which of course executes without error.

Jamie.

--
 

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