From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Connectivity Microsoft Access Alter Table (Add column)

Hi,

 

I am trying to programmaticaly by using databse connectivity toolkit add a column to a current table in a database.

i am using a file dsn and access 2007.

I can do just about anything but send an alter statmenet to accessd atabase to add a column

 

I am using the following syntax

 

ALTER TABLE mytable ADD COLUMN newcolumn NUMBER[NULL]

 

also tried this

 

ALTER TABLE mytable ADD COLUMN newcolumn NUMBER

 

they both give me an error saying syntax error.  can someone provide me the right syntax to add a column to an existing table? I know microsoft access says it does not support ALTER commands.  not sure if there is a workaround.

 

thanks,

 

sam

0 Kudos
Message 1 of 4
(3,758 Views)

I don't think the problem is the ALTER TABLE statement, because Access can handle that.  I think it's the NUMBER as a type you want to assign.  It's too generic.

I think yo should use one of the following for numbers

 

  • SHORT: This is for natural numbers, relatively large
  • INTINTEGER, and LONG: This is for (very large) natural numbers
  • SINGLE and REAL: This is for decimal numbers that do not need much precision
  • DOUBLE and NUMERIC: This is for decimal numbers that need precision

 

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 2 of 4
(3,705 Views)

Brjon,

 

sorry for the long time to read this message.  I am still not able to get this working. I am trying to alter the table to add a numberic double number in a column.  would you be able to provide me the syntax to do this?  right now I tried the following and it is not working.

 

ALTER TABLE Frequencies ADD COLUMN 20-30000 NUMBER DOUBLE[NULL];

 

can you let me know where is my mistake on this?

 

many thanks in advance,

 

Sarkis

0 Kudos
Message 3 of 4
(3,634 Views)

Hi ssherian,

 

From a quick search (since I am not too familiar with MS Access), is this what you are trying to do?

 

EXTERNAL Link: MS Access Alter Table Add Column

 

 

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 4 of 4
(3,617 Views)