Re: Access conversion to SQL

Tech-Archive recommends: Fix windows errors by optimizing your registry



problems, MsSql doesn't. I can't even use the words True or False
in an sql statement.

I don't have any trouble using the words True and False
in a MSsql statement.

chkAdmin.Checked = GetField("select admin from users where
username='Bert';", "admin")

That works for me: you will have to be more careful with the
way you write GetField.


Access/Jet/Intel/ and others use -1 as True.

MS SQL/ C/ Digital/ and others used +1 as True.

Access/Jet will correctly translate Boolean values as long as you are
careful to only use them as Boolean's (not as numbers).

Alternatively, you can choose to only use numbers (0,1 Null), so
that your SQL is clearer, more exact, and more portable, but then
you won't be able to depend on the sign of TRUE.

Many people choose to only use FALSE (note that it has the
same value in both systems). They use NOT FALSE instead of
TRUE.

Many people choose to only use numbers instead of Booleans.

It is a real problem, but nobody solves it by using "two loads
of code". If you are doing that, you are doing something wrong.

(david)


"tclancey" <tull@xxxxxxxxxxxxxxxx> wrote in message
news:OKDimXUdHHA.208@xxxxxxxxxxxxxxxxxxxxxxx
Hi all.

I have an application that currently connects to an Access database, now
the
customers are asking for a MySql and MsSql server back end database.

MySql handles True and False values through the bit field without any
problems, MsSql doesn't. I can't even use the words True or False in an
Sql
statement.

This means I have to write two loads of code for every transaction where
there is a true/false value involved, a complete pain.

It also gives me the problem of setting controls true/false value by
checking a table field:
chkAdmin.Checked = GetField("select admin from users where
username='Bert';", "admin")
(Get field is a routine that loads a data record and returns the field as
the second parameter)

As SQL never returns a true or false value in this way I have to write
extra
code for every check, or checked list, etc.

Is there a way around this?

Cheers,
Tull.




.



Relevant Pages

  • Re: SQL string problem
    ... clean up your parameters before sending them to SQL. ... > You must "escape" any single quotes when sending SQL statements ... > Just pass your SQL statement through this function when opening your ... >> Here is the full SQL statement that is assigned to the strSQL ...
    (microsoft.public.excel.programming)
  • Re: SQL Statement or Cursor
    ... > Your post seems to ask whether you're better off using a cursor or a sql ... > you can achieve this in a SQL Statement, but I'll offer a caution to you ... SQL Server's tsql doesn't have a rownum ... >> Initial Result Set but lacking Incrementing number. ...
    (microsoft.public.sqlserver.programming)
  • Re: Populating a list -- table structure?
    ... this clears up a lot of issues and jargon with SQL. ... I think I'll have to try to get a query that will take the BKitIDs and the KitIDs and bring that information together. ... Queries (just shows the QBE grid for convenience -- ... and It really helps to use Aliases for tablenames as it makes the SQL statement shorter. ...
    (microsoft.public.access.forms)
  • Re: Emailing a Report
    ... CTRL-G to Goto the debuG window -- look at the SQL statement ... The Sub LoopAgmtsSendEmail is highlighted by the Debugger. ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQL string problem
    ... You must "escape" any single quotes when sending SQL statements directly to ... Just pass your SQL statement through this function when opening your ... > Here is the full SQL statement that is assigned to the strSQL ...
    (microsoft.public.excel.programming)