--
-- WARNING: This file was automatically generated by BX CodeGenerator
--

------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSEMPPRINTER
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSEMPPRINTER'
	AND ((name LIKE '%BXPLMSEMPPRINTER%BXPPrnCd%') 
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSEMPPRINTER because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSEMPPRINTER'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPPrnCd')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSEMPPRINTER because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSEMPPRINTER' AND COLUMN_NAME = 'U_BXPPrnCd'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSEMPPRINTER] ALTER COLUMN U_BXPPrnCd nvarchar(30)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSMOBTAL
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSMOBTAL'
	AND ((name LIKE '%BXPLMSMOBTAL%BXPEnCd%') 
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSMOBTAL because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSMOBTAL'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPEnCd')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSMOBTAL because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTAL' AND COLUMN_NAME = 'U_BXPEnCd'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSMOBTAL] ALTER COLUMN U_BXPEnCd nvarchar(30)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSMOBLOG
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSMOBLOG'
	AND ((name LIKE '%BXPLMSMOBLOG%BXPItmCd%') 
	OR (name LIKE '%BXPLMSMOBLOG%BXPWHCod%')
	OR (name LIKE '%BXPLMSMOBLOG%BXPWHTo%')
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSMOBLOG because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSMOBLOG'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPItmCd','U_BXPWHCod','U_BXPWHTo')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSMOBLOG because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBLOG' AND COLUMN_NAME = 'U_BXPItmCd'
		IF @dataType <> 'nvarchar(20)' ALTER TABLE [@BXPLMSMOBLOG] ALTER COLUMN U_BXPItmCd nvarchar(20)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBLOG' AND COLUMN_NAME = 'U_BXPWHCod'
		IF @dataType <> 'nvarchar(8)' ALTER TABLE [@BXPLMSMOBLOG] ALTER COLUMN U_BXPWHCod nvarchar(8)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBLOG' AND COLUMN_NAME = 'U_BXPWHTo'
		IF @dataType <> 'nvarchar(8)' ALTER TABLE [@BXPLMSMOBLOG] ALTER COLUMN U_BXPWHTo nvarchar(8)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSMOBPICK
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSMOBPICK'
	AND ((name LIKE '%BXPLMSMOBPICK%BXPItmCd%') 
	OR (name LIKE '%BXPLMSMOBPICK%BXPWHCod%')
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSMOBPICK because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSMOBPICK'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPItmCd','U_BXPWHCod')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSMOBPICK because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBPICK' AND COLUMN_NAME = 'U_BXPItmCd'
		IF @dataType <> 'nvarchar(20)' ALTER TABLE [@BXPLMSMOBPICK] ALTER COLUMN U_BXPItmCd nvarchar(20)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBPICK' AND COLUMN_NAME = 'U_BXPWHCod'
		IF @dataType <> 'nvarchar(8)' ALTER TABLE [@BXPLMSMOBPICK] ALTER COLUMN U_BXPWHCod nvarchar(8)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSMOBTEN
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSMOBTEN'
	AND ((name LIKE '%BXPLMSMOBTEN%BXPItmCd%') 
	OR (name LIKE '%BXPLMSMOBTEN%BXPLnCod%')
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSMOBTEN because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSMOBTEN'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPItmCd','U_BXPLnCod')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSMOBTEN because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTEN' AND COLUMN_NAME = 'U_BXPItmCd'
		IF @dataType <> 'nvarchar(20)' ALTER TABLE [@BXPLMSMOBTEN] ALTER COLUMN U_BXPItmCd nvarchar(20)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTEN' AND COLUMN_NAME = 'U_BXPLnCod'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSMOBTEN] ALTER COLUMN U_BXPLnCod nvarchar(30)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSMOBTLN
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSMOBTLN'
	AND ((name LIKE '%BXPLMSMOBTLN%BXPHdCd%') 
	OR (name LIKE '%BXPLMSMOBTLN%BXPItmCd%')
	OR (name LIKE '%BXPLMSMOBTLN%BXPWHCod%')
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSMOBTLN because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSMOBTLN'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPHdCd','U_BXPItmCd','U_BXPWHCod')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSMOBTLN because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTLN' AND COLUMN_NAME = 'U_BXPHdCd'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSMOBTLN] ALTER COLUMN U_BXPHdCd nvarchar(30)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTLN' AND COLUMN_NAME = 'U_BXPItmCd'
		IF @dataType <> 'nvarchar(20)' ALTER TABLE [@BXPLMSMOBTLN] ALTER COLUMN U_BXPItmCd nvarchar(20)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSMOBTLN' AND COLUMN_NAME = 'U_BXPWHCod'
		IF @dataType <> 'nvarchar(8)' ALTER TABLE [@BXPLMSMOBTLN] ALTER COLUMN U_BXPWHCod nvarchar(8)
	END
END
GO
------------------------------------------------------------
-- Altering columns for indexes on table @BXPLMSPRINTLAYOUT
------------------------------------------------------------
DECLARE @dataType nvarchar(max)
DECLARE @constraintName nvarchar(max)
DECLARE @constraintNameList nvarchar(max)
DECLARE @indexName nvarchar(max)
DECLARE @indexNameList nvarchar(max)
DECLARE @errorCount int
DECLARE c1 CURSOR FOR SELECT name FROM sysobjects 
	WHERE parent_obj = id AND name = '@BXPLMSPRINTLAYOUT'
	AND ((name LIKE '%BXPLMSPRINTLAYOUT%BXPLayCd%') 
	OR (name LIKE '%BXPLMSPRINTLAYOUT%BXPPrnCd%')
)
SET @constraintNameList = ''
SET @errorCount = 0
OPEN c1
FETCH NEXT FROM c1 INTO @constraintName
WHILE @@FETCH_STATUS = 0 BEGIN
	IF @errorCount = 0 SET @constraintNameList = @constraintName
	ELSE SET @constraintNameList = @constraintNameList + ', ' + @constraintName
	SET @errorCount = @errorCount + 1
	FETCH NEXT FROM c1 INTO @constraintName
END
CLOSE c1
DEALLOCATE c1
IF @errorCount > 0 BEGIN
	PRINT 'W:101:Columns types will not be modified on table @BXPLMSPRINTLAYOUT because one or more columns are accessed by the following constraint(s): ' + @constraintNameList
END ELSE BEGIN
	DECLARE c1 CURSOR FOR SELECT DISTINCT i.name
		FROM sysindexes i, sys.index_columns ic, sys.columns c, sysobjects o
		WHERE i.id = o.id AND o.name = '@BXPLMSPRINTLAYOUT'
		AND i.id = ic.object_id AND i.indid = ic.index_id 
		AND ic.object_id = c.object_id AND ic.column_id = c.column_id 
		AND (i.status & 64) = 0 AND (i.status & 8388608) = 0 AND (i.status & 16777216)= 0 --exclude autostatistic index
		AND c.name IN ('U_BXPLayCd','U_BXPPrnCd')
	SET @indexNameList = ''
	SET @errorCount = 0
	OPEN c1
	FETCH NEXT FROM c1 INTO @indexName
	WHILE @@FETCH_STATUS = 0 BEGIN
		IF @errorCount = 0 SET @indexNameList = @indexName
		ELSE SET @indexNameList = @indexNameList + ', ' + @indexName
		SET @errorCount = @errorCount + 1
		FETCH NEXT FROM c1 INTO @indexName
	END
	CLOSE c1
	DEALLOCATE c1
	IF @errorCount > 0 BEGIN
		PRINT 'W:102:Columns types will not be modified on table @BXPLMSPRINTLAYOUT because one or more columns are accessed by the following index(es): ' + @indexNameList
	END ELSE BEGIN
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSPRINTLAYOUT' AND COLUMN_NAME = 'U_BXPLayCd'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSPRINTLAYOUT] ALTER COLUMN U_BXPLayCd nvarchar(30)
		SELECT @dataType = DATA_TYPE + '(' + cast(CHARACTER_MAXIMUM_LENGTH as nvarchar) + ')' FROM information_schema.Columns WHERE TABLE_NAME = '@BXPLMSPRINTLAYOUT' AND COLUMN_NAME = 'U_BXPPrnCd'
		IF @dataType <> 'nvarchar(30)' ALTER TABLE [@BXPLMSPRINTLAYOUT] ALTER COLUMN U_BXPPrnCd nvarchar(30)
	END
END
GO
