LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

adding NEW columns (fieldnames) to and access database

How can I add a new column (fieldname) to an existing database using Labview.  I can currently read and write to the db but I need to programmatically add a column.
0 Kudos
Message 1 of 5
(1,207 Views)
Highlighted
You need to execute an ALTER TABLE statement something like:
ALTER TABLE my_table
ADD my_new_column INTEGER

This statement will add a new column called "my_new_column" containing integer data to the table "my_table".
And you can also add constraints such as NOT NULL if desired. However your ability to execute this statement from LV
will be dependent upon the permissions that have been granted to your account has been granted.

Mike..



Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 5
(1,204 Views)
Highlighted

Mike,

 

I have a similar requirement. Could you please post an example VI to add new columns programmatically.

0 Kudos
Message 3 of 5
(950 Views)
Highlighted

Hi Sarasvisu,

 

I believe it should look something like this:

 

sql_add_column.png 

 

This would add a column called newField of type Text into the myNewTestTable table.  As Mike noted, you will need permissions to modify the database though. 

Jared S.
Applications Engineering
National Instruments
Message 4 of 5
(928 Views)
Highlighted
Thanks. Much Appreciated.
0 Kudos
Message 5 of 5
(920 Views)