From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MSSQL table valued expressions & custom types

Hello,

 

I use stored procedures a lot in LV to interact with database. 

Now I need to pass large data set into stored procedure, 

 

https://docs.microsoft.com/en-us/sql/relational-databases/tables/use-table-valued-parameters-databas...

 

this seems like the best option. How can pass custom types using NI DB connectivity toolkit? I can choose only basic types like string or numeric

0 Kudos
Message 1 of 7
(2,801 Views)

Do you have an example of the query you want to build????

Roger Garcia, Certified LabVIEW Developer

HTML tutorial

There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 2 of 7
(2,775 Views)

Sory for late response

 

For example:

 

DECLARE @myVar AS TestType;
INSERT INTO @myVar
VALUES
(1,'233333332'),
(2,'asd');

 

EXEC MultipleInsert @myVar

 

I can do this directly from SSMS and executes fine.

When I try to pass custom data type to stored procedure using LV I always get error about invalid argument data types. 

Untitled.png

0 Kudos
Message 3 of 7
(2,763 Views)

Two points:

 

First, how large is large? Are we talking a couple hundred bytes or a couple million?

Second, the problem is the DBCT. It is large and cumbersome, and as you are finding, unnecessarily restrictive.

 

Better to use ADO to talk directly to the DBMS.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 7
(2,755 Views)

Thanks for reply.

 

We are talking about ~5k rows to insert and inserting row by row using SP will take too long.

I can use ado directly but problem will remain the same - how to pass my custom structure into parameter correctly and how to get size correctly

 

Capture.PNG

0 Kudos
Message 5 of 7
(2,746 Views)

I have tried multiple other options and still can not get it right for custom types.

 

Bez tytułu.png

 

I have tried from C# and works without problems.

0 Kudos
Message 6 of 7
(2,723 Views)

Hi,

 

sorry for putting up this older thread, but did you finally get it running using LabVIEW and TVP's?

 

Thanks for an answer!

0 Kudos
Message 7 of 7
(1,968 Views)