I've been struggling to get the defined data table to be accepted as a variable for one of the parameters of the stored procedure.
1st time using user defined tables so I may have made syntax errors
This will be so I can send a data table from a c# program instead of individually inserting each row.
Stored Procedure
CREATE PROCEDURE [dbo].[Upload_AddBulkProducts]
@uploadedTable CSV_ADDProducts readonly
AS
INSERT INTO [dbo].[Products]
SELECT * FROM @uploadedTable
GO
Error = undefined variable The error i get when trying to create the stored procedure
User Defined Table
CREATE TYPE [dbo].[CSV_ADDProducts] AS TABLE(
[Product Item] [nvarchar](50) NULL,
[Product SKU] [bigint] NULL,
[Product Name] [nvarchar](max) NULL,
[Product Active] [nchar](10) NULL,
[Product Selling Price] [money] NULL,
[Product Description] [nvarchar](max) NULL,
[Product Purchase Description] [nvarchar](max) NULL,
[Product VAT Code ID] [bigint] NOT NULL,
[Product Last Update] [datetime] NULL
)
GO
dynamic sql