Showing results for 
Search instead for 
Did you mean: 

Labview- How to delete duplicates and order records in MS SQL server, from Labview itself.



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,


0 Kudos
Message 1 of 5

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.



Note: Kudos are grateful.

Italian Developer engineer
Message 2 of 5

In case you have not known. You must install NI LabVIEW Database Connectivity Toolkit ( to have database functions like g_Ricky suggested.


Message 3 of 5

You do not have to buy the NI toolkit, you can use free libraries such as LabSQL.


It still works up to LabVIEW 2010, sp1.


0 Kudos
Message 4 of 5

Thanks, TLE. Shall check to see how effective your suggestion is.

0 Kudos
Message 5 of 5