LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

0 Kudos
Message 1 of 5
(1,599 Views)

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.

Ricky
Italian Developer engineer
www.www.selt-sistemi.com
Message 2 of 5
(1,592 Views)

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.

original.png

Message 3 of 5
(1,577 Views)

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.

 

0 Kudos
Message 4 of 5
(1,564 Views)

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

0 Kudos
Message 5 of 5
(1,561 Views)