I want to pass a datatable to a stored procedures. I found the below article and have been using this as my template.
I created the below Type successfully but when trying to use it in the stored procedure I'm getting below error.
Msg 137, Level 16, State 1, Procedure POProcess, Line 31 [Batch Start Line 7]
Must declare the scalar variable "@POC".
How do I fix this?
CREATE TYPE POComponent AS TABLE (
[id_PO] [int] IDENTITY(1,1) NOT NULL,
[promisedDate] [datetime] NULL,
[qty] [int] NULL
ALTER PROCEDURE [dbo].[POProcess] (
@POC POComponentType READONLY
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SET promisedDate = @POC.promisedDate,
qty = @POC.qty
WHERE id_PO = @POC.id_PO