Tech Tips
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to delete Default Constrraint from SQL server 2000

Go down

How to delete Default Constrraint from SQL server 2000 Empty How to delete Default Constrraint from SQL server 2000

Post  Admin 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 : 60
Join date : 2009-06-05

https://softro.forumotion.net

Back to top Go down

Back to top

- Similar topics

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