Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Updating defaults?

Author  Topic 

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-07-25 : 18:30:45
Is there any way to update a db-defined default rather than unbinding, dropping, recreating and re-binding??

I just tried updating a 'bound' default on my database and it wouldn't let me without un-binding first.

Preferably by not using system tables/undocumented stored procs...


Cheers,

Tim

Kristen
Test

22859 Posts

Posted - 2006-07-26 : 07:20:21
I guess you aren't meaning this then?

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[MyConstraintName]')
AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.MyTableName DROP CONSTRAINT MyConstraintName

ALTER TABLE dbo.MyTableName ADD CONSTRAINT
MyConstraintName DEFAULT (1) FOR MyColumnName

Kristen
Go to Top of Page
   

- Advertisement -