Monday, February 13, 2012

Add a Default to an existing Column

I tried this:
CREATE DEFAULT TempToPerm_DF AS false
sp_bindefault TempToPerm_DF, 'Template.TempToPerm'
and I get this:
The name 'false' is not permitted in this context. Only constants,
expressions, or variables allowed here. Column names are not permitted.
I reread the documentation and I'm just not getting it.
Any help?
Thanks,
Darwin FiskWhat is the datatype of 'Template.TempToPerm'? If it is bit, then use 0 -
not false. If it is varchar, then use 'false' (quotes included).
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Darwin Fisk" <Darwin@.DotNetDesigns.com> wrote in message
news:%238Tt%23SMuFHA.1264@.TK2MSFTNGP12.phx.gbl...
I tried this:
CREATE DEFAULT TempToPerm_DF AS false
sp_bindefault TempToPerm_DF, 'Template.TempToPerm'
and I get this:
The name 'false' is not permitted in this context. Only constants,
expressions, or variables allowed here. Column names are not permitted.
I reread the documentation and I'm just not getting it.
Any help?
Thanks,
Darwin Fisk|||Duh! bit... 0 not false... Thanks!
Darwin
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uUxsuWMuFHA.3188@.TK2MSFTNGP14.phx.gbl...
> What is the datatype of 'Template.TempToPerm'? If it is bit, then use 0 -
> not false. If it is varchar, then use 'false' (quotes included).
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Darwin Fisk" <Darwin@.DotNetDesigns.com> wrote in message
> news:%238Tt%23SMuFHA.1264@.TK2MSFTNGP12.phx.gbl...
> I tried this:
> CREATE DEFAULT TempToPerm_DF AS false
> sp_bindefault TempToPerm_DF, 'Template.TempToPerm'
> and I get this:
> The name 'false' is not permitted in this context. Only constants,
> expressions, or variables allowed here. Column names are not permitted.
> I reread the documentation and I'm just not getting it.
> Any help?
> Thanks,
> Darwin Fisk
>

No comments:

Post a Comment