DECLARE @inx_name VARCHAR(250)
SET @inx_name =(select [name] from sys.indexes where is_primary_key<>0 AND object_id = OBJECT_ID('CREDITOS'))
IF (@inx_name IS NOT NULL)
 DECLARE @CmdText VARCHAR(1000)
 SET @CmdText='ALTER TABLE CREDITOS DROP CONSTRAINT '+@inx_name
 EXEC(@CmdText)
GO
ALTER TABLE CREDITOS ALTER COLUMN CRE_NUM VARCHAR(20) NOT NULL
GO
ALTER TABLE CREDITOS ADD CONSTRAINT [PK_CREDITOS] PRIMARY KEY CLUSTERED 
(
	[CRE_NUM] ASC,
	[CRE_CIA] ASC,
	[CRE_NIT] ASC
)
GO
DECLARE @inx_name VARCHAR(250)
SET @inx_name =(select [name] from sys.indexes where is_primary_key<>0 AND object_id = OBJECT_ID('CUENTASPORPAGAR'))
IF (@inx_name IS NOT NULL)
 DECLARE @CmdText VARCHAR(1000)
 SET @CmdText='ALTER TABLE CUENTASPORPAGAR DROP CONSTRAINT '+@inx_name
 EXEC(@CmdText)
GO
ALTER TABLE CUENTASPORPAGAR ALTER COLUMN VCE_NUM VARCHAR(20) NOT NULL
GO
ALTER TABLE CUENTASPORPAGAR ADD CONSTRAINT [PK_CUENTASPORPAGAR] PRIMARY KEY CLUSTERED (VCE_TIP,VCE_NUM,VCE_NV,VCE_NIT,VCE_CIA)
GO
ALTER TABLE APLICACXP ALTER COLUMN APL_NUM VARCHAR(20)
ALTER TABLE DOCUMENTOS ALTER COLUMN DOC_FAC VARCHAR(20)