question

AjayKumarChandora avatar image
0 Votes"
AjayKumarChandora asked ·

Change AutoIncrementSeed of datacolumn in c# programatically


Language :- visual C#
database :- SQL server
subject :- change in autoincrementseed for a datacolumn of a datatable of SQL server database in C# file codeI have an application which keep records of different work persons.

I want to set autoincrementseed value for identity column for same department persons different than any other department.


sql-server-general
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered ·

If you want different running numbers for different departments, you will need to roll your own, and you cannot use the IDENTITY feature in SQL Server. If you only have a handful departments, you could have one sequence per department, but that quickly gets messy.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.