IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='EST_RPS_AUDIT') 
BEGIN
CREATE TABLE [dbo].[EST_RPS_AUDIT](
	[CD_CTR_AUDIT_TRIGGER] [bigint] IDENTITY(1,1) NOT NULL,
	[ID_AUDIT] [bigint] NULL,
	[SPID] [int] NULL,
	[DT_EVENT] [datetime] NULL,
	[OPERACAO] [varchar](20) NULL,
	[DS_USUARIO] [varchar](200) NULL,
	[DS_USUARIO_ORIGINAL] [varchar](200) NULL,
	[DS_TIPO_USUARIO] [varchar](200) NULL,
	[DS_IP] [varchar](100) NULL,
	[DS_HOSTNAME] [varchar](150) NULL,
	[DS_SOFTWARE] [varchar](150) NULL,
	[SQL] [varchar](500) NULL,
	[CD_EMP] [int] NULL,
	[CD_FILIAL] [int] NULL,
	[NUM_RPS] [int] NULL,
	[STATUS] [int] NULL,
	[DT_COMP] [datetime] NULL,
	[DT_EMIS] [datetime] NULL,
 CONSTRAINT [PK_EST_RPS_AUDIT] PRIMARY KEY CLUSTERED 
(
	[CD_CTR_AUDIT_TRIGGER] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
END


