Table value parameters in Stored Procedures

Posts   
 
    
ddp74
User
Posts: 4
Joined: 04-Jan-2024
# Posted on: 04-Jan-2024 16:45:24   

Hey, is it possible to use TVPs in LLBLGen yet? I know it wasn't back in v4. We're on v5.9.2 RTM.

When I tried to add the sproc it errored saying it couldn't determine the number of result sets as it was trying to use an nvarchar instead of the TVP.

I can't see any way in the designer to add a new type in either and there's no option in the sproc's type list for the TVP either. The TVP is this:

CREATE TYPE VersionKey AS TABLE
(
    Id int NOT NULL,
    VersionId int NOT NULL
)

The sproc is defined like this:

CREATE PROCEDURE GetSomeMagicalValue
    @Keys VersionKey READONLY
AS
BEGIN
    SET NOCOUNT ON;
    -- Do something with @Keys
END

To get around this in the past I'd send through a CSV text string and split it on the SQL side, but ideally I want to pass through a number of objects instead like:

DataTable results = RetrievalProcedures.GetSomeMagicalValue(new VersionKey[] { new VersionKey(1,0), new VersionKey(2,10) });
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 05-Jan-2024 10:26:03   
Frans Bouma | Lead developer LLBLGen Pro