M
M
Michelin1232021-12-08 23:07:27
SQL Server
Michelin123, 2021-12-08 23:07:27

How to make sure that the start date is not later than the finish date?

How to put a limit between two dates

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2021-12-08
@Michelin123

CREATE TABLE [dbo].[StartFinish](
  [DateStart] [datetime] NULL,
  [DateFinish] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StartFinish] WITH CHECK 
  ADD CONSTRAINT [CK_StartFinish] CHECK ((datediff(day,[DateStart],[DateFinish])>(0)))
GO
ALTER TABLE [dbo].[StartFinish] CHECK CONSTRAINT [CK_StartFinish]
GO

Guide .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question