IF OBJECT_ID('CG_FND_VERBA_NOTA_CREDITO') IS NULL
begin
CREATE TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO](
	[CD_CTR_NOTA_CREDITO] [int] IDENTITY(1,1) NOT NULL,
	[NM_CONTRATO] [varchar](150) NOT NULL,
	[ANO_REF] [int] NOT NULL,
	[MES_REF] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[HIST_LANC] [varchar](max) NOT NULL,
 CONSTRAINT [PK_CG_FND_VERBA_NOTA_CREDITO] PRIMARY KEY CLUSTERED 
(
	[CD_CTR_NOTA_CREDITO] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [IX_CG_FND_VERBA_NOTA_CREDITO] UNIQUE NONCLUSTERED 
(
	[NM_CONTRATO] 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]


ALTER TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO] ADD  CONSTRAINT [DF_CG_FND_VERBA_VERBA_MIDIA_NOME_CONTRATO]  DEFAULT ('') FOR [NM_CONTRATO]

ALTER TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO] ADD  CONSTRAINT [DF_CG_FND_VERBA_NOTA_CREDITO_ANO_REF]  DEFAULT ((0)) FOR [ANO_REF]

ALTER TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO] ADD  CONSTRAINT [DF_CG_FND_VERBA_NOTA_CREDITO_MES_REF]  DEFAULT ((0)) FOR [MES_REF]

ALTER TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO] ADD  CONSTRAINT [DF_CG_FND_VERBA_NOTA_CREDITO_CD_USU]  DEFAULT ((0)) FOR [CD_USU]

ALTER TABLE [dbo].[CG_FND_VERBA_NOTA_CREDITO] ADD  CONSTRAINT [DF_CG_FND_VERBA_VERBA_MIDIA_HISTORICO]  DEFAULT ('') FOR [HIST_LANC]
end