Author Topic: How to Alter column with a Default constraint  (Read 6786 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
How to Alter column with a Default constraint
« on: March 08, 2011, 10:24:41 AM »
1- Drop the constraint first.
2- Alter the column.
3- recreate the constraint again.
Code: [Select]
ALTER TABLE dbo.TPURENTRY
DROP CONSTRAINT TPURENTRY_ADDITIONNALINFO_DF
GO

ALTER TABLE dbo.TPURENTRY
ALTER COLUMN ADDITIONNALINFO VARCHAR(MAX) NULL
GO

ALTER TABLE dbo.TPURENTRY 
ADD CONSTRAINT TPURENTRY_ADDITIONNALINFO_DF DEFAULT '' FOR ADDITIONNALINFO
GO