Answer the question
In order to leave comments, you need to log in
Auto insert timestamp value ms sql how to do?
Good day, I apologize immediately for stupid questions)
The bottom line is that you need to create a stored procedure so that when data is entered into the database, the timestamp column is automatically filled with the current date and time ...
USE [arch_to_report]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure AddValue
(@Time_val datetime,
@Val1 real,
@Val2 real,
@Val3 real,
@Val4 real)
as
begin
insert [dbo].[Values] values (@Time_val, @Val1, @Val2, @Val3, @Val4);
end
Answer the question
In order to leave comments, you need to log in
ALTER TABLE [dbo].[Values] ADD CONSTRAINT DF_T1_timestamp DEFAULT GETDATE() FOR [timestamp]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question