LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL - Writing data to SQL database

Hi All,
I´m trying to use the database connectivity toolset from NI to write data to an SQL database. I have the data as .txt files, they contain measurment values and their units. I convert this .txt files to an array of strings, add a colum with the data and the serial number of the measured device and then I want to write this data to an SQL table. The problem is, that I need to define the data type of each value I want to write to the SQL table (is that true?). The second problem is that I have over 50 tables with different styles, means dirfferent number of colums and different data types. I tried to use the DB Tools Insert Data.vi, but with them I only can write a specified cluster in the database.
Does anybody knows, how I can
solve my problem??

Thank you in advance

Daniel from Austria
0 Kudos
Message 1 of 2
(2,845 Views)
In response to your first question, you don't have to define the datatype for each value you're inserting, but you do need to be sure that the data you're passing to a specific column is compatable with that column's dataype.

Next, If you have 50 tables that all have different structures you can create 50 wrappers that go around the Insert Data function and formats the input data for one specific table. (Not my immediate choice.)

Alternately, you can go straight to SQL and create a table of your own containing 50 insert statements--each for a specific table. To make an insert you would first fetch the appropriate insert statement from your table in the database, populate the data into the statement, and execute the modified statement.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
0 Kudos
Message 2 of 2
(2,845 Views)