-- Add new int field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF INT NULL
--------------------------------------------------------------------------------------------------
-- Add new nvarchar field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF NVARCHAR(60) NULL
--------------------------------------------------------------------------------------------------
-- Add new decimal field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF DECIMAL(28,9) NULL
--------------------------------------------------------------------------------------------------
-- Add new bit field (incl. update existing records with 0)
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT')) BEGIN
ALTER TABLE TTTTT ADD FFFFFF BIT CONSTRAINT [rdf_TTTTT_FFFFFF] DEFAULT (0)
EXEC ('UPDATE TTTTT SET FFFFFF = 0')
END
--------------------------------------------------------------------------------------------------
-- Add new ntext field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF NTEXT NULL
--------------------------------------------------------------------------------------------------
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF INT NULL
--------------------------------------------------------------------------------------------------
-- Add new nvarchar field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF NVARCHAR(60) NULL
--------------------------------------------------------------------------------------------------
-- Add new decimal field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF DECIMAL(28,9) NULL
--------------------------------------------------------------------------------------------------
-- Add new bit field (incl. update existing records with 0)
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT')) BEGIN
ALTER TABLE TTTTT ADD FFFFFF BIT CONSTRAINT [rdf_TTTTT_FFFFFF] DEFAULT (0)
EXEC ('UPDATE TTTTT SET FFFFFF = 0')
END
--------------------------------------------------------------------------------------------------
-- Add new ntext field
IF NOT EXISTS(SELECT [Name] FROM syscolumns WHERE Name = 'FFFFFF' AND ID = OBJECT_ID('dbo.TTTTT'))
ALTER TABLE TTTTT ADD FFFFFF NTEXT NULL
--------------------------------------------------------------------------------------------------
No hay comentarios:
Publicar un comentario