SQL Table Identity change dynamically

Last Reply 6 days ago By dharmendr

Posted one month ago
CREATE TABLE [dbo].[Customers] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[Customer] VARCHAR (MAX) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);

Result:

1 Fahim

2 Ahmed

I need to change ID dynamically on each date change

201907170001 Fahim

201907170002 Ahmed

and when date change it should again start seeding but date will be changed

201907180001 Fahim

201907180002 Ahmed

Or is there any way to pass value from lable which will have date in this format 20190717

You are viewing reply posted by: fahimahmed one month ago.
Posted one month ago

Seems good, and works fine but the issue is on date change it continues seeding the same series while it should restart series on date change.