How to delete Default Constrraint from SQL server 2000
Tech Tips :: Databases :: MS SQL Server
Page 1 of 1
How to delete Default Constrraint from SQL server 2000
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
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
Similar topics
» Server.MapPath
» Automating the Backup Of SQL Server Database
» SQL-Server-Date-Styles-formats-using-CONVERT
» HTTP Error 500.0 - Internal Server Error Calling LoadLibraryEx on ISAPI
» Unable to make the session state request to the session state server
» Automating the Backup Of SQL Server Database
» SQL-Server-Date-Styles-formats-using-CONVERT
» HTTP Error 500.0 - Internal Server Error Calling LoadLibraryEx on ISAPI
» Unable to make the session state request to the session state server
Tech Tips :: Databases :: MS SQL Server
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|