I do not know what is the type cat
you are using to define @c. So are you trying to do something like this?
EDIT: As you have mentioned that cat
is of type table, you can insert the ID
into the @c variable, and pass that variable to CONNECT
function.
Also not sure if a variable of type cat
will go with a function with parameter of type table
. You might need to update the function CONNECT
to take in variable of type cat
instead of table
. Check the links here
http://www.sailajareddy-technical.blogspot.in/2012/09/passing-table-valued-parameter-to.html
declare @c cat;
insert into @c
select m2.ID
from miasta m1
inner join miasta m2 on (m1.ID <= m2.ID and m1.ID = @a)
inner join miasta m3 on (m3.ID> = m2.ID and m3.ID = @b)
SELECT * FROM dbo.CONNECT(@c)
If this is not what you need then please elaborate your question.
Hope this helps.