IF NOT EXISTS (SELECT * FROM sysobjects WHERE name = 'EST_RPS_NFSE_ARQ_DANFE' and xtype = 'U') 
BEGIN 
CREATE TABLE [dbo].[EST_RPS_NFSE_ARQ_DANFE](
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[RPS_ID] [int] NOT NULL,
	[DT_CAD] [datetime] NULL,
	[NR_PROTOCOLO] [varchar](50) NULL,
	[ARQUIVO_DANFE] [varbinary](max) NULL,
 CONSTRAINT [EST_RPS_NFSE_ARQ_DANFE_PK] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_FILIAL] ASC,
	[RPS_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
