How to delete Default Constrraint from SQL server 2000

View previous topic View next topic Go down

How to delete Default Constrraint from SQL server 2000

Post  Admin on Fri Jun 05, 2009 10:55 am

declare @default_name varchar(256)
select @default_name = [name] from sys.default_constraints
where parent_object_id = object_id('CustomerReport')
and col_name(parent_object_id, parent_column_id) = 'rundate'

exec('alter table dbo.CustomerReport drop constraint ' + @default_name)
go

alter table dbo.CustomerReport
add constraint df_CustomerReport_rundate default getutcdate() for rundate
go

see reference:http://www.mssqltips.com/tip.asp?tip=1425

Admin
Admin

Posts : 50
Join date : 2009-06-05

View user profile http://softro.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum