473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

ALTER TABLE ... ADD COLUMN with SQL Server

Hello all

I'm trying to migrate a BE from Access to SQL Server.

I've been making changes to the Access BE from the FE with SQL
statements, and want to do the same with the BE in SQL Server.

When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
‘COLUMN'"

I've been trying to find help on syntax in the help file, and some
Access-to-SQL Server books, but can't find anything on this specific
problem.

Many thanks in advance for any suggestions and help.

Regards
Mike L
Nov 13 '05 #1
5 49650
"Mike L" <ml******@arms.co.za> wrote in message
news:c3**************************@posting.google.c om...
Hello all

I'm trying to migrate a BE from Access to SQL Server.

I've been making changes to the Access BE from the FE with SQL
statements, and want to do the same with the BE in SQL Server.

When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
'COLUMN'"

DATE is not a dataytpe. Use DATETIME instead.

I've been trying to find help on syntax in the help file, and some
Access-to-SQL Server books, but can't find anything on this specific
problem.


Books Online (BOL) which comes with sql server is a model for what a help
system should look like IMO. Look up Data Types and Alter Table statement.
Nov 13 '05 #2
I eventually did find info on data types in the meantime, and tried
the DATETIME data type, but with the same result.

Maybe I'm missing something more fundamental...

(My SQL Server came with Office XP Dev Ed, and limited help)

"John Winterbottom" <as******@hotmail.com> wrote in message news:<2h************@uni-berlin.de>...
"Mike L" <ml******@arms.co.za> wrote in message
news:c3**************************@posting.google.c om...
Hello all

I'm trying to migrate a BE from Access to SQL Server.

I've been making changes to the Access BE from the FE with SQL
statements, and want to do the same with the BE in SQL Server.

When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
'COLUMN'"

DATE is not a dataytpe. Use DATETIME instead.

I've been trying to find help on syntax in the help file, and some
Access-to-SQL Server books, but can't find anything on this specific
problem.


Books Online (BOL) which comes with sql server is a model for what a help
system should look like IMO. Look up Data Types and Alter Table statement.

Nov 13 '05 #3
On May 24 2004, 11:09 am, ml******@arms.co.za (Mike L) wrote in
news:c3**************************@posting.google.c om:
When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
‘COLUMN'"


The proper syntax is ALTER TABLE tblTest ADD TestColumn3 ...
(not ... ADD COLUMN ...)

As John said, this is very well described in Books Online under ALTER TABLE
topic.

--
remove a 9 to reply by email
Nov 13 '05 #4
Thanks Dimitri

Dimitri Furman <df*****@cloud99.net> wrote in message news:<Xn****************************@127.0.0.1>...
On May 24 2004, 11:09 am, ml******@arms.co.za (Mike L) wrote in
news:c3**************************@posting.google.c om:
When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
?COLUMN'"


The proper syntax is ALTER TABLE tblTest ADD TestColumn3 ...
(not ... ADD COLUMN ...)

As John said, this is very well described in Books Online under ALTER TABLE
topic.

Nov 13 '05 #5
Thanks Dimitri

Dimitri Furman <df*****@cloud99.net> wrote in message news:<Xn****************************@127.0.0.1>...
On May 24 2004, 11:09 am, ml******@arms.co.za (Mike L) wrote in
news:c3**************************@posting.google.c om:
When running the statement "ALTER TABLE tblTest DROP COLUMN
TestColumn3" from the FE with a SQL Server BE, it works OK.
Running the statement "ALTER TABLE tblTest ADD COLUMN TestColumn3
DATE" however gives an error "Incorrect syntax near the keyword
?COLUMN'"


The proper syntax is ALTER TABLE tblTest ADD TestColumn3 ...
(not ... ADD COLUMN ...)

As John said, this is very well described in Books Online under ALTER TABLE
topic.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dylan Nicholson | last post by:
Seems that Oracle 9.2 (using MS ODBC driver) requires extra parentheses when adding multiple columns to a table: ALTER TABLE MyTable ADD (MyColumn1 VARCHAR(255), MyColumn2 VARCHAR(255)) vs ...
2
by: Heist | last post by:
Hi, I just want to know to turn this: CREATE TABLE . ( NOT NULL , (50) COLLATE French_CI_AS NULL , NOT NULL , (50) COLLATE French_CI_AS NOT NULL , NULL , NULL ) ON into this:
7
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int...
1
by: Danny | last post by:
I'm trying to simply change a column definition from Null to Not Null. It's a multi million row table. I've already checked to make sure there are no nulls for any rows and a default has been...
3
by: Darin | last post by:
I have many columns in different tables set to money. I want to change those to be decimal(18,2). I do the following: ALTER TABLE AROpenItem ALTER COLUMN copn_taxamt decimal(19,2) I get an...
4
by: Jeff Kish | last post by:
Hi. I have a database I need to supply something (I'm assuming a t-sql script.. maybe something else is better) to update customer tables with. The operations include mostly changing varchar...
2
by: RamaKrishna Narla | last post by:
In MS SQL Server, I have the following tables with some data in it. create table table1 ( column1 varchar(32), column2 int not null, column10 varchar(255), ..... primary key (column1,...
2
by: Jeff_in_MD | last post by:
Hi, I'm trying to add a column to a table, then update that column with a query. This is all within a single batch. Sqlcmd gives me an error on the update, saying "invalid column xxx", because...
7
by: quincy451 | last post by:
drop table . CREATE TABLE . ( NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , NULL , NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , (16) COLLATE
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.