Sintax error in SQL INSERT INTO sentence 
Author Message
 Sintax error in SQL INSERT INTO sentence

I created an Access database, with a table using logical (Yes/No) fields. I
create an ODBC data source linked to that database. Then I try to append
records to that table using a SQL sentence 'INSERT INTO...' as argument to a
call to CDatabase::ExecuteSQL. The problem is: when I run the program, it
launches an ODBC exception, saying that there is a sintax error in the SQL
sentence.

The sentence is something like...

'INSERT INTO TABLE (BOOLFIELD1, BOOLFIELD2, ...) VALUES (0, 0, ...)'

?How can I specify boolean or logical constants in a SQL sentence? ?Is this
a problem with SQL, ODBC, or JET engine? ?What else can I be doing wrong?

Thanks in advande for any suggestion.

Regards,
  Ismael



Sun, 28 Jul 2002 03:00:00 GMT  
 Sintax error in SQL INSERT INTO sentence
Is the name of the table "TABLE"?  Or did you just type it that way for the
benefit of this message?

What is the data type of BOOLFIELD1, etc.?  Are they bit, int, smallint,
tinyint, or what?



Sun, 28 Jul 2002 03:00:00 GMT  
 Sintax error in SQL INSERT INTO sentence
Thanks a lot for yor answer.

The name 'TABLE' is for clarity. The data typo of BOOLFIELD1 is 'Yes/No' as
defined in an Access database.

Regards,
  Ismael



Quote:
> Is the name of the table "TABLE"?  Or did you just type it that way for
the
> benefit of this message?

> What is the data type of BOOLFIELD1, etc.?  Are they bit, int, smallint,
> tinyint, or what?



Mon, 29 Jul 2002 03:00:00 GMT  
 Sintax error in SQL INSERT INTO sentence
A "Yes/No" field is considered a 'bit' field in SQL, allowing only the values 0
and 1.  Given your statement in the original post, I don't see the syntax error.


Mon, 29 Jul 2002 03:00:00 GMT  
 Sintax error in SQL INSERT INTO sentence


Quote:
> A "Yes/No" field is considered a 'bit' field in SQL, allowing only the values 0
> and 1.  Given your statement in the original post, I don't see the syntax error.

But, Access doesn't follow the standard.  You need to put in yes/no or true/false or
y/n, but 1/0 won't work.  (At least it didn't a couple months ago.)

John



Mon, 29 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Sintax error in SQL INSERT INTO sentence

2. SQL XML Bulk Insert

3. Inserting bytes into binary field in SQL 2K

4. Trying to insert data into SQL Server

5. Database SQL INSERT

6. SQL Server: Slow INSERT performance??

7. SQL question - DELETE, INSERT queries

8. Using sql to insert data into Access database

9. Inserting a Delimited Text File into SQL Server

10. Newbie: Looking for Simplest Code to OpenConnection, OpenRecordset, Execute A SQL Statement Insert/Update

11. Insert in SQL Server CTable<CDynamicAccessor>

12. Insert to SQL from Access

 

 
Powered by phpBB® Forum Software