I'd like to have a database schema with a parent table and a few derived tables, such as:
CREATE TABLE Base(
[Id] [int] Identity(1,1) primary key clustered,
[field1] [varchar](80) NOT NULL,
[field2] [datetime] NOT NULL,
--...
)
CREATE TABLE DerivedA(
[Id] [int] primary key clustered,
[field1] [varchar](10) NOT NULL,
--...
)
CREATE TABLE DerivedB(
[Id] [int] primary key clustered,
[field1] [varchar](50) NOT NULL,
[field1] [varchar](50) NOT NULL,
--...
)
CREATE TABLE DerivedC(
[Id] [int] primary key clustered,
[field1] [varbinary](100) NOT NULL,
--...
)
-- and so on...
Naturally I'd want my derived tables to have a foreign key constraint on Id referencing the Id on the base table, but I'm unsure on how to do so when the base table PK is an identity field though, as the Id is generated when the row is inserted.