Filter resultset by passing a table value parameter

33 views
Skip to first unread message

Tiago

unread,
Oct 30, 2020, 12:48:02 PM10/30/20
to tSQLt
Hi everyone,

I'm trying to create a test for a stored procedure that returns 2 result sets and Im only interested on the 2nd one.
This SP takes some parameters and one of them is a table value parameter .
Do you have any idea on how can I make it work?

Something like this:

CREATE TYPE countryList AS TABLE(
countryID smallint
)


DECLARE @countryList as countryList ;
insert into @countryList VALUES(1),(2)


EXEC tsqlt.ResultSetFilter 2, 'exec myprocedure @countries = @countryList"

Error : " System.Data.SQLClient.SQLException: Must declare the scalar variable "@countryList" "

Thanks all,
Tiago

Sebastian Meine

unread,
Oct 30, 2020, 12:58:08 PM10/30/20
to ts...@googlegroups.com
Tiago,

try putting the declaration and the insert inside of the command that tSQLt.ResultSetFilter is executing.

Thanks,

Sebastian


--
You received this message because you are subscribed to the Google Groups "tSQLt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tsqlt+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tsqlt/a2d10cb9-22f7-4614-95df-d2d938433041n%40googlegroups.com.

Tiago

unread,
Oct 30, 2020, 3:09:10 PM10/30/20
to tSQLt
Spot on.

Thanks a lot Sebastian, that made the trick.

Have a good weekend all,
Tiago
Reply all
Reply to author
Forward
0 new messages