473,322 Members | 1,806 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,322 software developers and data experts.

Run a script to alter a column in a table?

Is it possible to run a simple script to alter a table column in Access
database from an interger to a double? I have been writing C++ programs
every time we need to upgrade (modify) the Access database, but found
it cumbersome. I know I can change database definition via Access GUI
interface itself, but if the database is at a remote site, and if I
don't want the users to mess around with the database by themselves,
then I have to implement the modification with a script or a program
and just ask them to run it.
Thanks.

Feb 20 '06 #1
5 5269
mi****@excite.com wrote:
Is it possible to run a simple script to alter a table column in Access
database from an interger to a double? I have been writing C++ programs
every time we need to upgrade (modify) the Access database, but found
it cumbersome. I know I can change database definition via Access GUI
interface itself, but if the database is at a remote site, and if I
don't want the users to mess around with the database by themselves,
then I have to implement the modification with a script or a program
and just ask them to run it.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use DDL. You'll need a statement like this (Access 2002
ANSI92):

ALTER TABLE <table name> ALTER COLUMN <column name> DOUBLE

Run this as if it were a regular SQL command.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/pKboechKqOuFEgEQI0hgCg2QqOie8Ok//gbiYMcZSTNR1XlCcAoNG3
ilbaSkmXx9d+cdyQSjwjswEN
=t5w6
-----END PGP SIGNATURE-----
Feb 20 '06 #2

MGFoster wrote:
mi****@excite.com wrote:
Is it possible to run a simple script to alter a table column in Access
database from an interger to a double? I have been writing C++ programs
every time we need to upgrade (modify) the Access database, but found
it cumbersome. I know I can change database definition via Access GUI
interface itself, but if the database is at a remote site, and if I
don't want the users to mess around with the database by themselves,
then I have to implement the modification with a script or a program
and just ask them to run it.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use DDL. You'll need a statement like this (Access 2002
ANSI92):

ALTER TABLE <table name> ALTER COLUMN <column name> DOUBLE

Run this as if it were a regular SQL command.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/pKboechKqOuFEgEQI0hgCg2QqOie8Ok//gbiYMcZSTNR1XlCcAoNG3
ilbaSkmXx9d+cdyQSjwjswEN
=t5w6
-----END PGP SIGNATURE-----


Thanks for the reply!
For running the SQL command like that, I need to open the Access
database, and somehow copy that statement into the Queries section as a
query, and run it, right? Is there a way to do it by not opening the
Access?

Feb 21 '06 #3
mi****@excite.com wrote:
MGFoster wrote:
mi****@excite.com wrote:
Is it possible to run a simple script to alter a table column in Access
database from an interger to a double? I have been writing C++ programs
every time we need to upgrade (modify) the Access database, but found
it cumbersome. I know I can change database definition via Access GUI
interface itself, but if the database is at a remote site, and if I
don't want the users to mess around with the database by themselves,
then I have to implement the modification with a script or a program
and just ask them to run it.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use DDL. You'll need a statement like this (Access 2002
ANSI92):

ALTER TABLE <table name> ALTER COLUMN <column name> DOUBLE

Run this as if it were a regular SQL command.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/pKboechKqOuFEgEQI0hgCg2QqOie8Ok//gbiYMcZSTNR1XlCcAoNG3
ilbaSkmXx9d+cdyQSjwjswEN
=t5w6
-----END PGP SIGNATURE-----

Thanks for the reply!
For running the SQL command like that, I need to open the Access
database, and somehow copy that statement into the Queries section as a
query, and run it, right? Is there a way to do it by not opening the
Access?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes. Use ADO. That's why I said "Run this as if it were a regular SQL
command." Use the adCmdText in the Connection's Execute method:

cnx.Execute "ALTER TABLE <table name> ALTER COLUMN <column name>
DOUBLE",, adCmdText

or, however it is set up in C++.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/qOOoechKqOuFEgEQI0ygCfc2hk7xKqPCwAy5GN1QsnjIg/ztMAoM/E
FRgBz7Rn0Po2rzCjtOmRmBSf
=VYuR
-----END PGP SIGNATURE-----
Feb 21 '06 #4
> -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes. Use ADO. That's why I said "Run this as if it were a regular SQL
command." Use the adCmdText in the Connection's Execute method:

cnx.Execute "ALTER TABLE <table name> ALTER COLUMN <column name>
DOUBLE",, adCmdText

or, however it is set up in C++.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/qOOoechKqOuFEgEQI0ygCfc2hk7xKqPCwAy5GN1QsnjIg/ztMAoM/E
FRgBz7Rn0Po2rzCjtOmRmBSf
=VYuR
-----END PGP SIGNATURE-----


Thanks!

Feb 23 '06 #5
> -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes. Use ADO. That's why I said "Run this as if it were a regular SQL
command." Use the adCmdText in the Connection's Execute method:

cnx.Execute "ALTER TABLE <table name> ALTER COLUMN <column name>
DOUBLE",, adCmdText

or, however it is set up in C++.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/qOOoechKqOuFEgEQI0ygCfc2hk7xKqPCwAy5GN1QsnjIg/ztMAoM/E
FRgBz7Rn0Po2rzCjtOmRmBSf
=VYuR
-----END PGP SIGNATURE-----


Thanks!

Feb 23 '06 #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 ...
1
by: Lannsjo | last post by:
I need to change my primary key column type from smallint to int. I have tried: ALTER TABLE livegroup MODIFY id INT UNSIGNED NOT NULL AUTO_INCREMENT; But get an error message certainly since my...
1
by: Bruce | last post by:
Hi, I want to change the datatype of an existing column from char to varbinary. When I run the "Alter Table" statement, I get the following error message - Disallowed implicit conversion...
5
by: Neil | last post by:
How can I create a script that updates a table with new fields without losing the data in the table (i.e., without dropping and recreating the table)? Thanks.
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...
1
by: vasilip | last post by:
I'm testing out db2 for a project I'm starting that requires proper xml support and I can't seem to get both xml and spatial data to work well in the same table. Once having created a table...
2
by: rcamarda | last post by:
Hello, I need to alter fields in all my tables of a given database, and I would to do this via a t-sql script. Example, I want to change all fields called SESSION_ID to char(6). The field is...
3
by: Shestine | last post by:
I am trying to add a column to a current table, with data in it. I am only learning, and i have no idea how to change this to make it work. Here is the script I have right now it, but what it does is...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.