In QA I can alter a table with
ALTER TABLE dbo.Incidents ADD NewIncident int NOT NULL default 0
However later on I wish to remove the default on this column. However
upon creation the defualt is given a name like
DF__Incidents__NewIn__05D9AC15
Can I a) Give a name to the default upon creation or b) get the name of
the default for the column so i can then remove it like
DROP CONSTRAINT DF_Incidents_NewIncident
ThanksNever let SQL Server name your constraints, name them yourself:
create table t(c1 int constraint d_t default 1)
go
exec sp_helpconstraint t
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rippo" <info@.rippo.co.uk> wrote in message
news:1126094026.545449.59440@.g14g2000cwa.googlegroups.com...
> In QA I can alter a table with
> ALTER TABLE dbo.Incidents ADD NewIncident int NOT NULL default 0
>
> However later on I wish to remove the default on this column. However
> upon creation the defualt is given a name like
> DF__Incidents__NewIn__05D9AC15
> Can I a) Give a name to the default upon creation or b) get the name of
> the default for the column so i can then remove it like
>
> DROP CONSTRAINT DF_Incidents_NewIncident
> Thanks
>|||I prefer to name them as Tibor recommended. See if this helps:
http://www.microsoft.com/communitie...72e7&sloc=en-us
AMB
"Rippo" wrote:
> In QA I can alter a table with
> ALTER TABLE dbo.Incidents ADD NewIncident int NOT NULL default 0
>
> However later on I wish to remove the default on this column. However
> upon creation the defualt is given a name like
> DF__Incidents__NewIn__05D9AC15
> Can I a) Give a name to the default upon creation or b) get the name of
> the default for the column so i can then remove it like
>
> DROP CONSTRAINT DF_Incidents_NewIncident
> Thanks
>
No comments:
Post a Comment