CREATE TABLE [dbo].[TabSyncMovMag] (
    [CodCS]            NCHAR (2)      NOT NULL,
    [CodStatoFrom]     NVARCHAR (50)  NOT NULL,
    [CodStatoTo]       NVARCHAR (50)  NOT NULL,
    [IdxPosizioneFrom] INT            NOT NULL,
    [IdxPosizioneTo]   INT            NOT NULL,
    [toExt]            BIT            CONSTRAINT [DF_TabSyncMovMag_toAs400] DEFAULT ((1)) NOT NULL,
    [codMagExtFrom]    NVARCHAR (50)  NULL,
    [codMagExtTo]      NVARCHAR (50)  NULL,
    [codMagExtComp]    NVARCHAR (50)  NULL,
    [toDistinta]       BIT            CONSTRAINT [DF_TabSyncMovMag_toDistinta] DEFAULT ((0)) NOT NULL,
    [codMagExtDist]    NVARCHAR (50)  NULL,
    [note]             NVARCHAR (500) NULL,
    CONSTRAINT [PK_TabSyncMovMag] PRIMARY KEY CLUSTERED ([CodCS] ASC, [CodStatoFrom] ASC, [CodStatoTo] ASC, [IdxPosizioneFrom] ASC, [IdxPosizioneTo] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'posizione (stato) logica di partenza', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'IdxPosizioneFrom';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'posizione (stato) logica di arrivo', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'IdxPosizioneTo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'determina se inviare l''informazione al sistema esterno', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'toExt';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'cod magazzino from, NULL significa non valido e non utilizzato', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'codMagExtFrom';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'cod magazzino from, NULL significa non valido e non utilizzato', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'codMagExtTo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'cod magazzino from, 0 o null significa non valido', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'codMagExtComp';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'descrizione della regola', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'TabSyncMovMag', @level2type = N'COLUMN', @level2name = N'note';

