comma delimited parameter

Last updated:

Warning: Review and test in a non-production environment before running.

Back to results

create type dbo.integers as table(item int primary key);
go

create procedure dbo.findOrdersUsingTVP
  @list dbo.integers READONLY
as
begin
    set nocount on;

    select *
      from Sales.Orders as h
     where exists (select 1 from @list where item = h.OrderID);

end;
go

declare @a as integers;
insert into @a values(1),(2),(3);

exec findOrdersUsingTVP @a
go