
/*------ ATD 309503 ------*/
IF EXISTS (SELECT 1 FROM SYS.COLUMNS COL JOIN SYS.TABLES TAB ON COL.object_id = TAB.object_id WHERE TAB.NAME = 'ATENDEREQUISICAOVALOR' AND COL.NAME = 'ITEM' AND COL.IS_IDENTITY = 0)
BEGIN
  IF ((SELECT COUNT(*) FROM ATENDEREQUISICAOVALOR) < 1)
  BEGIN
    DROP TABLE ATENDEREQUISICAOVALOR
    
    CREATE TABLE ATENDEREQUISICAOVALOR
    (
      ITEM INT Identity(1,1) NOT NULL,
      TWNUMORD INT NOT NULL,
      TWITEM VARCHAR(254) NULL,
      CODPRO CHAR(5) NULL,
      QUANTIDADE NUMERIC(15,3) NULL,
      QUANTIDADEUTILIZADA NUMERIC(15,3) NULL,
      VALOR NUMERIC(18,5) NULL,
      DATA DATETIME NULL,
      NORMAL INT NULL
    )
    ALTER TABLE ATENDEREQUISICAOVALOR ADD CONSTRAINT PK_ATENDEREQUISICAOVALOR PRIMARY KEY CLUSTERED(ITEM)
  END
END
GO