
-- B2C_Credito ajuste tamanho coluna
	IF EXISTS (SELECT * FROM sys.OBJECTS where name = 'B2C_CREDITO')
		BEGIN
			ALTER TABLE [dbo].[B2C_CREDITO]
				ALTER COLUMN NUMERO_TITULO VARCHAR(36)
		END
	ELSE
		BEGIN
			CREATE TABLE [dbo].[B2C_CREDITO](
										[ID_CREDITO]			[int] IDENTITY(1,1) NOT NULL,
										[CODIGO_FILIAL_ORIGEM]	[char](6)			NULL,
										[PEDIDO]				[int]				NULL,
										[CODIGO_CLIENTE]		[char](14)			NULL,
										[CHAVE]					[char](50)			NULL,
										[VALOR]					[numeric](18, 2)	NULL,
										[DATA_CREDITO]			[datetime]			NULL,
										[VALIDADE]				[int]				NULL,
										[ATIVO]					[bit]				NOT NULL,
										[UID_ROW]				[uniqueidentifier]	NULL,
										[NUMERO_TITULO]			[varchar](36)		NULL,
										[CHEQUE_CARTAO]			[varchar](35)		NULL,
										[CODIGO_VALE_ORIGEM]	[varchar](40)		NULL,
										[PEDIDO_ORIGEM]			[int]				NULL,
									 CONSTRAINT [XPKB2C_CREDITO] PRIMARY KEY CLUSTERED 
									(
										[ID_CREDITO] ASC
									)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
									) ON [PRIMARY]
									ALTER TABLE [dbo].[B2C_CREDITO] ADD  CONSTRAINT [DF_B2C_CREDITO_ATIVO]  DEFAULT ((0)) FOR [ATIVO]
									ALTER TABLE [dbo].[B2C_CREDITO] ADD  CONSTRAINT [DF_B2C_CREDITO_UID_ROW]  DEFAULT (newid()) FOR [UID_ROW]
		END
