Monday, March 19, 2012

Alter Table

Hi,
I would like to add a column in an existing table with this code.
ALTER TABLE tCheckImport ADD COLUMN bStdOpt BOOL
But it doesn' t work, what' s wrong with it ?
RegardsJust to add something, I want to set the default value to this column as
'False' too.
Thanks
"JuliaC" wrote:

> Hi,
> I would like to add a column in an existing table with this code.
> ALTER TABLE tCheckImport ADD COLUMN bStdOpt BOOL
> But it doesn' t work, what' s wrong with it ?
> Regards
>|||SQL Server doesnt know about BOOL, its bit there.
ALTER TABLE tCheckImport ADD bStdOpt BIT
HTH, jens Suessmeyer.|||Just to add that too:
ALTER TABLE tCheckImport ADD bStdOpt BIT DEFAULT 0
HTH, Jens Suessmeyer.|||That's what I am looking for
Thanks
"Jens" wrote:

> SQL Server doesnt know about BOOL, its bit there.
> ALTER TABLE tCheckImport ADD bStdOpt BIT
> HTH, jens Suessmeyer.
>|||Note, though, that bit is *not* a Boolean datatype. It is a numeric datatype
restricted to null, 1
and 0. It is up to us who uses the code to interpret whether 1 would corresp
ond to true or false.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"JuliaC" <JuliaC@.discussions.microsoft.com> wrote in message
news:BB388399-2AA3-4ED5-9D88-5E6CC857E85E@.microsoft.com...
> That's what I am looking for
> Thanks
> "Jens" wrote:
>

No comments:

Post a Comment