Re: Newbie, True and False
- From: "Scott Morris" <bogus@xxxxxxxxx>
- Date: Fri, 30 Mar 2007 15:38:49 -0400
"tclancey" <tull@xxxxxxxxxxxxxxxx> wrote in message
news:%23z5at5vcHHA.4820@xxxxxxxxxxxxxxxxxxxxxxx
Hi All.
First time working on an SQL database. I'm able to create all my tables
and fields without errors. I can work eith the back end pretty well, but
I can't work out True or False Fields/Columns.
If I try:
Insert Into MyTable (value1, value2) values (true, false);
I'm told that true (or false) cannot be used as they are column names or
keywords.
Brace yourself. What does "I'm told" mean? A rhetorical question - this
time I think I know what is happening. In the future, you should quote any
errors exactly and completely and tell us exactly how you came to encounter
the error. Usually this means providing some clue about the application you
are using to execute queries. In addition, you should always specify which
version of sql server you are using alsong with the SP level.
I've searched and searched for the answer, all the info I've found pretty
much contradicts itself!
Make a note of the "sources" that told you that you could use TRUE or FALSE.
Ignore them for all future information needs.
I'm using a Bit field, which surely should mean 1=True, 0=False. Does
with any other database.
What am I doing wrong? !!
Assuming that 1 = TRUE and that 0 = FALSE. They aren't. TSQL is not
C/C++/VB, there is no boolean datatype, and you cannot evaluate a number (by
itself) as a boolean expression. If you want to use a bit value of 1, then
you must specify 1 (and not TRUE or "TRUE" or 'TRUE'). If you have a
background in Access, then there are many other things that you will need to
relearn when using sql server. I recommend you search (and post to, if
needed) the .programming NG since it is more focused on sql server
programming and experiences much higher volume.
.
- Follow-Ups:
- Re: Newbie, True and False
- From: tclancey
- Re: Newbie, True and False
- References:
- Newbie, True and False
- From: tclancey
- Newbie, True and False
- Prev by Date: Newbie, True and False
- Next by Date: Re: Newbie, True and False
- Previous by thread: Newbie, True and False
- Next by thread: Re: Newbie, True and False
- Index(es):
Relevant Pages
|