07-26-2013 08:15 AM
Hi Everyone,
I'm wondering whether DB Tools Insert Data VI is able to accept an array as it's input data. It's a little hard to tell because whatever you wire to the input of this VI is willingly accepted by the variant data type terminal, so no glaringly obvious broken wires occur when you do wire up an array.
What I'm trying to do is write a 2D array of doubles to a single cell in a table. The array is 3x1000 elements large. I admit being completely new to databases and such an effort may or may not sound rediculous in the database world. If anyone wants to talk about why I'm attempting that I'll gladly run through my reasoning - just suffice to say I'm not totally mad.
When I try to write said array to a single cell an error occurs as seen in the attached screen shot. All of my other databse functions, which work with scalar values of many different data types, are all working fine.
I've attached the problematic code. It's attempting to write 8 of these arrays to 8 individual columns, all in the same row. I'm just using the "automatic" method at the moment.
Extra tid bit info:
OpenSQL database. Connecting via ODBC 5.2 64bit, User DSN.
LabVIEW 2012 non SP1. Windows 7 64bit.
Thanks all!
Rhys.
Solved! Go to Solution.
07-26-2013 08:27 AM
Convert the array to a spreadsheet string and store it that way.
07-26-2013 09:40 AM
Thanks for the reply - learnt a new function today!
It turns out the strings produced are too big for a single cell to handle - as such I'm going to have to rethink my DB archtiecture a little. That said, still a perfect fix for whenever you're trying to write less than about 3000 characters per cell 🙂
07-26-2013 09:48 AM
What DB architecture are you using? If you are using MSSQL, varchar(max) can store up to 2GB of data in one cell.
http://msdn.microsoft.com/en-us/library/ms176089.aspx
If you are using MySQL, the longtext datatype can store up to 4,294,967,295 characters.
http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html