I have a table wich I want to let its ID be specified per person
This is what I have so far:
CREATE TABLE [dbo].[Duiken] (
[Duik_nr] INT IDENTITY (1, 1) NOT NULL, // ID
[datum] DATE NULL,
[naam] VARCHAR (50) NOT NULL, // Person
[buddy] VARCHAR (50) NULL,
[locatie] VARCHAR (50) NULL,
[zicht] INT NULL,
[lucht_temp] INT NULL,
[water_temp] INT NULL,
[fles_Groote] VARCHAR (50) NULL,
[duik_tijd] INT NULL,
[max_duik_diepte] INT NULL,
[lucht_in] INT NULL,
[lucht_uit] INT NULL,
[lucht_verbruik] AS ([lucht_in]-[lucht_uit]),
[lood] INT NULL,
[oefenduik] BIT NULL,
[recreatieve_duik] BIT NULL,
[zoetwater_duik] BIT NULL,
[zoutwater_duik] BIT NULL,
[stilstaand_water] BIT NULL,
[stromend_water] BIT NULL,
[nacht_duik] BIT NULL,
[nitrox_duik] BIT NULL,
[zonnig] BIT NULL,
[bewolkt] BIT NULL,
[regen] BIT NULL,
[Opmerkingen] VARCHAR (MAX) NULL,
PRIMARY KEY ([naam],[Duik_nr])
);
But when I add a new record on a new name it continues with the highest ID in the table.
So the "test" person should also begin with ID 1 instead of 53.
something like this:
+----+------+ | id | Name | +----+------+ | 1 | a | | 2 | a | | 1 | b | | 3 | a | | 1 | c | | 2 | b | +----+------+