View Single Post

   
  #5 (permalink)  
Old 02-29-2008, 06:52 AM
Karsten Stelling
 
Posts: n/a
Default Re: changing the default value for a column

Hi,

something like this could meet your requirements:

declare @myStatement nvarchar(4000)

select @myStatement=('ALTER TABLE RP_CUSTOM_ATTRIBUTE DROP CONSTRAINT ' +
(select so.name
from sysobjects so, syscolumns sc
where sc.name = 'YOUR_COLUMN_NAME' and sc.cdefault = so.id))

EXEC sp_executesql @myStatement
go

Karsten

"Johan Vervloet" <johanv@chiro.be> schrieb im Newsbeitrag
news:41fe1db7$0$28977$e4fe514c@news.xs4all.nl...
> David Portas schreef:
> > ALTER TABLE table_name
> > DROP CONSTRAINT name_of_default_constraint

>
> Thank you for the quick reply. But how do I know the
> name_of_default_constraint? I created the default value like this:
>
> alter table /table_name/ add default /default_value/ for /column_name/
>
> Johan




Reply With Quote