CREATE TABLE [dbo].[pr_families_formulas]
(
[pff_family_code] [dbo].[ais_code_short] NOT NULL,
[pff_formula_code] [dbo].[ais_code_short] NOT NULL,
[pff_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[pff_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[pff_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[pff_rowver] [timestamp] NOT NULL,
[pff_display_order] [int] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[pr_families_formulas] ADD
CONSTRAINT [FK_pr_families_formulas_pr_families] FOREIGN KEY ([pff_family_code]) REFERENCES [dbo].[pr_families] ([pf_family_code]) ON UPDATE CASCADE

ALTER TABLE [dbo].[pr_families_formulas] ADD
CONSTRAINT [CK__pr_families_formulas_pff_formula_code__string_pk] CHECK ((len(ltrim(rtrim([pff_formula_code])))>(0) AND charindex('*',[pff_formula_code])=(0) AND charindex('%',[pff_formula_code])=(0)))
GO
ALTER TABLE [dbo].[pr_families_formulas] ADD CONSTRAINT [PK_pr_families_formulas] PRIMARY KEY CLUSTERED  ([pff_family_code], [pff_formula_code]) ON [PRIMARY]
GO
