My table structure is below:
CREATE TABLE [ACC].[Document](
[DocumentID] [int] IDENTITY(1,1) NOT NULL,
[Date] [date] NOT NULL,
[SalesCompanyFinancialPeriodID] [int] NOT NULL,
[DocumentTypeID] [int] NULL,
CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED
(
[DocumentID] ASC
)
I want to partitioning my table on SalesCompanyFinancialPeriodID column. is it possible to DocumentID column value reset on each partition. in other word DocumentID in each partition wat independent by DocumentID in other partition.
Depending on your exact criteria you could create a view if the reference numbers are only needed on the fly:
However, this will change if documents are deleted. Otherwise your only alternative as far as I am aware with SQL-Server 2008 is to maintain a sequence either with a trigger or within your application layer. Below is how I would achieve this with a trigger.