IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS 
				WHERE TABLE_NAME='PG_FORN' AND COLUMN_NAME='NM_ARQ_ENV' )
BEGIN
	ALTER TABLE PG_FORN ALTER COLUMN NM_ARQ_ENV VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
END
ELSE
BEGIN
	ALTER TABLE PG_FORN ADD NM_ARQ_ENV VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
END

IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS 
				WHERE TABLE_NAME='PG_FORN' AND COLUMN_NAME='NM_ARQ_RET' )
BEGIN
	ALTER TABLE PG_FORN ALTER COLUMN NM_ARQ_RET VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
END
ELSE
BEGIN
	ALTER TABLE PG_FORN ADD NM_ARQ_RET VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
END



/* Auditória */

IF EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME = 'PG_FORN_AUDIT_TRIGGER')
BEGIN
	IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS 
					WHERE TABLE_NAME='PG_FORN_AUDIT_TRIGGER' AND COLUMN_NAME='NM_ARQ_ENV' )
	BEGIN
		ALTER TABLE PG_FORN_AUDIT_TRIGGER ALTER COLUMN NM_ARQ_ENV VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
	END
	ELSE
	BEGIN
		ALTER TABLE PG_FORN_AUDIT_TRIGGER ADD NM_ARQ_ENV VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
	END

	IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS 
					WHERE TABLE_NAME='PG_FORN_AUDIT_TRIGGER' AND COLUMN_NAME='NM_ARQ_RET' )
	BEGIN
		ALTER TABLE PG_FORN_AUDIT_TRIGGER ALTER COLUMN NM_ARQ_RET VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
	END
	ELSE
	BEGIN
		ALTER TABLE PG_FORN_AUDIT_TRIGGER ADD NM_ARQ_RET VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
	END
END