I have a VALID sp_executesql
code, generated from C# ADO.NET, but the parameters are not passed to the stored procedure (SQL Server issue).
This is what I found with SQL Profiler:
declare @p3 StockSyncType
insert into @p3 values(3, 17594, 73471, 20, 5, 100, N'', N'', N'', N'')
insert into @p3 values(3, 17593, 73470, 20, 5, 100, N'', N'', N'', N'')
exec sp_executesql N'EXECUTE [dbo].[sp_SyncInventory] ',N'@Details [dbo].
[StockSyncType] READONLY',@Details=@p3
Here you can find the table type and stored procedure:
CREATE TYPE [dbo].[StockSyncType] AS TABLE(
[OperationTypeId] [int] NOT NULL,
[Product_ID] [int] NOT NULL,
[ProductAttribute_ID] [int] NOT NULL,
[Location_ID] [int] NOT NULL,
[StockType_ID] [int] NOT NULL,
[Quantity] [decimal](18, 0) NOT NULL,
[RowOrIsle] [nvarchar](10) NULL,
[Bay] [nvarchar](10) NULL,
[Shelf] [nvarchar](10) NULL,
[Bin] [nvarchar](55) NULL
)
GO
CREATE PROCEDURE [dbo].[sp_SyncInventory]
@Details StockSyncType READONLY
AS
BEGIN
SELECT *
FROM @Details
END
Please help ?! I don.t understand why no error is raised running the sp_executesql
, but the parameters are not sent.