I have a table defined as:
CREATE TABLE [dbo].[procInfo](
[id] [int] IDENTITY(1,1) NOT NULL,
[startTime] [datetime] NOT NULL,
[endTime] [datetime] NULL,
[procName] [varchar](50) NOT NULL,
CONSTRAINT [PK_procInfo] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
When I start a Process, I create a record for it using a LinQtoSQL Stored Procedure from my c# code.
Now when the process ends, I want to update the same record with the endtime. The id should remain same as it is referenced by other tables.
I am aware of the SQL queries:
SET IDENTITY_INSERT [dbo].[procInfo] ON
SET IDENTITY_INSERT [dbo].[procInfo] OFF
I have a way to store the id if the process that has finished. Now, I want to write a stored Procedure to update this record with the endTime. I have been trying various things, but none of those are working.
Any suggestions on how to do this ?
Perhaps I’m missing something, but couldn’t you simply use an UPDATE query?
It should be quite straightforward.