DECLARE @command NVARCHAR(1000)
DECLARE @column NVARCHAR(128)
-------------------------------------
-- PZ_DATAPROT
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATAPROT'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATAPROT
DEFAULT GETDATE() FOR PZ_DATAPROT
-- NOT NULL
ALTER TABLE FPPRO00F
ALTER COLUMN PZ_DATAPROT DATETIME NOT NULL

-------------------------------------
-- PZ_DATAACCET
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATAACCET'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATAACCET
DEFAULT GETDATE() FOR PZ_DATAACCET

-------------------------------------
-- PZ_DATACONT
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATACONT'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATACONT
DEFAULT GETDATE() FOR PZ_DATACONT

-------------------------------------
-- PZ_DATAREGCONT
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATAREGCONT'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATAREGCONT
DEFAULT GETDATE() FOR PZ_DATAREGCONT
-- NOT NULL
ALTER TABLE FPPRO00F
ALTER COLUMN PZ_DATAREGCONT DATE NOT NULL

-------------------------------------
-- PZ_DATAARCH
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATAARCH'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATAARCH
DEFAULT GETDATE() FOR PZ_DATAARCH

-------------------------------------
-- PZ_DATADOCR
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATADOCR'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATADOCR
DEFAULT GETDATE() FOR PZ_DATADOCR
-- NOT NULL
ALTER TABLE FPPRO00F
ALTER COLUMN PZ_DATADOCR DATE NOT NULL

-------------------------------------
-- PZ_NOMXML
-------------------------------------
ALTER TABLE FPPRO00F
ALTER COLUMN PZ_NOMXML CHAR(256) NOT NULL

-------------------------------------
-- PZ_DATAORARIC
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATAORARIC'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATAORARIC
DEFAULT GETDATE() FOR PZ_DATAORARIC

-------------------------------------
-- PZ_DATASTATO
-------------------------------------
-- DROP CONSTRAINT
SELECT @column = 'PZ_DATASTATO'
SELECT @command = 'ALTER TABLE FPPRO00F DROP CONSTRAINT ' + name
FROM sys.default_constraints
WHERE parent_object_id = OBJECT_ID('FPPRO00F')
  AND parent_column_id = COLUMNPROPERTY(OBJECT_ID('FPPRO00F'), @column, 'ColumnId')
EXECUTE (@command)
-- NEW DEFAULT CONSTRAINT
ALTER TABLE FPPRO00F
ADD CONSTRAINT DF_PZ_DATASTATO
DEFAULT GETDATE() FOR PZ_DATASTATO;