﻿CREATE TABLE [dbo].[ClientDet] (
    [CodClient]  NVARCHAR (50)  NOT NULL,
    [ClientName] NVARCHAR (250) NOT NULL,
    [CodAg]      NVARCHAR (50)  NOT NULL,
    [ZipCode]    NVARCHAR (50)  NOT NULL,
    [City]       NVARCHAR (50)  NOT NULL,
    [State]      NVARCHAR (50)  NOT NULL,
    [Nation]     NVARCHAR (50)  NOT NULL,
    [TranspZone] NVARCHAR (50)  CONSTRAINT [DF_ClientDet_Class01] DEFAULT ('') NULL,
    CONSTRAINT [PK_ClientDet] PRIMARY KEY CLUSTERED ([CodClient] ASC),
    CONSTRAINT [FK_ClientDet_AgentsDet] FOREIGN KEY ([CodAg]) REFERENCES [dbo].[AgentsDet] ([CodAg]) ON UPDATE CASCADE
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Client Details Table', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'codice cliente', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'CodClient';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Ragione Sociale', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'ClientName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'codice agente...', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'CodAg';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'cap', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'ZipCode';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'città', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'City';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'stato/provincia', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'State';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'nazione', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'Nation';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Classificazione cliente (es zona, provincia...) x incrocio con tab costi trasporto', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientDet', @level2type = N'COLUMN', @level2name = N'TranspZone';

