Re: Newbie, True and False

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"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.


.



Relevant Pages

  • Newbie, True and False
    ... First time working on an SQL database. ... I can work eith the back end pretty well, ... keywords. ...
    (microsoft.public.sqlserver.clients)
  • Re: Relational database & OO
    ... And when was the last time you saw an RDB that stored a telephone ... The modern relational theory permits to store values of user-defined type: ... Neither do the relational model or SQL. ... Your comprehension of the SQL database performance is not good. ...
    (comp.object)
  • Event log errors after moving sharepoint 3.0 database
    ... After following a procedure to move the location of the SQL databases from ... SQL Database 'WSS_Content' on SQL Server instance ... The local computer may not have the necessary registry ... information or message DLL files to display messages from a remote computer. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: ISA Log to SQL Database Question
    ... I am actually logging to an Access DB and the logs had grown to over 2 GB. ... The MSDE that comes with ISA or the real "full" MS SQL ... >> I have a question about ISA Logging to a SQL Database. ...
    (microsoft.public.isa.configuration)
  • RE: Automate Active Directory User Maintenance
    ... Hmmm...I know Quest has an ID management tool as well, but they are pricey. ... We've set it up for a client where the information is read from a SQL table ... could it evaulate the users in the SQL database ...
    (microsoft.public.windows.server.active_directory)