Using SQL Server 2019 I have a stored procedure where I pass in values via a user defined table type. One of the columns is a timestamp table type which is used for row version and data concurrency control.
From C# I load a datatable to pass in as a parameter for the UDT, however, I get an error saying I cannot write to a timestamp.
How can I pass the value of the timestamp into the stored procedure via a UDT where it can be used to compare with a timestamp value in the database?
Here’s my UDT:
CREATE TYPE [dbo].[tvp_Eav_Value] AS TABLE(
[EavVl_Id] [uniqueidentifier] NOT NULL,
[EavVl_EavEnt_Id] [uniqueidentifier] NOT NULL,
[EavVl_EavAt_Id] [uniqueidentifier] NOT NULL,
[EavVl_Value] [nvarchar](max) NULL,
[EavVl_LastModifiedUserId] [uniqueidentifier] NULL,
[EavVl_Stamp] [timestamp] NULL
)
And here’s the datatable I’m passing in:
DataTable dt = new DataTable();
dt.Columns.Add("EavVl_Id", typeof(Guid));
dt.Columns.Add("EavVl_EavEnt_Id", typeof(Guid));
dt.Columns.Add("EavVl_EavAt_Id", typeof(Guid));
dt.Columns.Add("EavVl_Value", typeof(string));
dt.Columns.Add("EavVl_LastModifiedUserId", typeof(Guid));
dt.Columns.Add("EavVl_Stamp", typeof(byte[]));
Thank you.