SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO

-----------------------------------------------------------------------------------------'
-- Aggiunta campo GT06_FLGNOSCMAG											 
-----------------------------------------------------------------------------------------'

IF NOT EXISTS(
    SELECT
        TOP 1 1
    FROM
        SYSCOLUMNS
    INNER JOIN SYSOBJECTS
	ON SYSOBJECTS.ID = SYSCOLUMNS.ID
    WHERE
        SYSCOLUMNS.NAME = 'GT06_FLGNOSCMAG'
	AND SYSOBJECTS.NAME = 'GT06_ARTICOLI'
)
	BEGIN
		ALTER TABLE GT06_ARTICOLI
		ADD GT06_FLGNOSCMAG TINYINT NULL
		
		PRINT 'Tabella GT06_ARTICOLI: campo GT06_FLGNOSCMAG creato'

	END
ELSE
	BEGIN
		PRINT 'Tabella GT06_ARTICOLI: campo GT06_FLGNOSCMAG esistente, creazione non effettuata'
	END
GO