09-20-2011 12:31 AM
Hi,
I've been experimenting and collecting data with the DSC and LAB view from the AB 1400 Micrologix PLC. I'm storing the data to MS SQL server. I need to delete duplicate records and order the records within the table by date and time in the MS SQL server once the data is stored there. Is there any means to do this using LABview commands? Can any MS SQL queries be run from Labview? I do not want to use an additional software like dotnet for this purpose.
Thanks in advance,
Paul
09-20-2011 02:19 AM
Hi PaulNI,
Using the "Execute Query" function which you can find under the DB tools palette, you would have to be able to send any query you want your SQL server to have to execute. The Execute command returns a reference to a recordset which you can handle as you want. Using the clause "DISTINCT" into your SELECT command you can have a recordset with a unique values from your table under query, therefore you can analyse that recordset and you can store the result in a different table and then you can delete the origin table. But, be careful in this kind of operations to not loose some data.
I hope it was helpful.
regards.
Note: Kudos are grateful.
09-20-2011 04:02 AM
In case you have not known. You must install NI LabVIEW Database Connectivity Toolkit (http://sine.ni.com/nips/cds/view/p/lang/en/nid/209060) to have database functions like g_Ricky suggested.
09-21-2011 10:11 AM
You do not have to buy the NI toolkit, you can use free libraries such as LabSQL.
http://jeffreytravis.com/lost/labsql.html
It still works up to LabVIEW 2010, sp1.
09-21-2011 10:51 AM
Thanks, TLE. Shall check to see how effective your suggestion is.