CREATE TABLE [dbo].[nm_countries_departments]
(
[nmctrd_country_code] [dbo].[ais_code_short] NOT NULL,
[nmctrd_dpi_code] [dbo].[ais_code_short] NOT NULL,
[nmctrd_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[nmctrd_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[nmctrd_l3] [nvarchar] (64) COLLATE French_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[nm_countries_departments] ADD CONSTRAINT [CK__nm_countries_departments_nmctrd_dpi_code__string_pk] CHECK ((len(ltrim(rtrim([nmctrd_dpi_code])))>(0) AND charindex('*',[nmctrd_dpi_code])=(0) AND charindex('%',[nmctrd_dpi_code])=(0)))
GO
ALTER TABLE [dbo].[nm_countries_departments] ADD CONSTRAINT [PK_nm_countries_departments] PRIMARY KEY CLUSTERED  ([nmctrd_country_code], [nmctrd_dpi_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[nm_countries_departments] ADD CONSTRAINT [FK_nm_countries_departments_nm_countries] FOREIGN KEY ([nmctrd_country_code]) REFERENCES [dbo].[nm_countries] ([nmctr_country_code])
GO
