LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Stored Procedure with declared variable

Solved!
Go to solution

In Labview I want to execute SQL code:

declare @mylist TableOfInvSt;
insert into @mylist values ('a'),('b'),('c')
EXEC get_data @mylist

 

Till today I used stored procedure with procedure values defined in labview only. Code Attached

0 Kudos
Message 1 of 6
(487 Views)
Solution
Accepted by topic author mitjaAl

 I got my solution. If anybody knows better way to do the same thing, please share it.

snip.png

0 Kudos
Message 2 of 6
(414 Views)

2 small anti-Rubes come to mind, there's a DB Tools Get Columns in the DB utils group and you get remove the final nested loop and convert directly to a 2D string array.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(400 Views)

@Yamaeda wrote:

 and convert directly to a 2D string array.


That's tricky though.

 

It will only work if all elements are strings. If one element is void, the entire conversion fails.

 

SQL Queries on Excel do that (return void in stead of "" for some (empty?) elements).

0 Kudos
Message 4 of 6
(383 Views)

wiebe@CARYA wrote:

SQL Queries on Excel do that (return void in stead of "" for some (empty?) elements).


Really? I've not played with SQL Excel 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(380 Views)

@Yamaeda wrote:

wiebe@CARYA wrote:

SQL Queries on Excel do that (return void in stead of "" for some (empty?) elements).


Really? I've not played with SQL Excel 🙂


I don't really recommend it. Apparently the 'database' driver uses DDE to loop over cells pretty much like a user would... But it distributes more reliable than the RGT (which doesn't mean much 😋).

 

You can (or could, it's been a while) even open a connection string to a txt file.

 

EDIT Something like this (not tested): 

Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\txtFilesFolder\;Extensions=asc,csv,tab,txt;
Data Source='C:\MyFolder';Delimiter=',';Has Quotes=True;Skip Rows=0;Has Header=True;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;Extended Properties="text; HDR=Yes; FMT=Delimited";
Message 6 of 6
(369 Views)