Syntax error in insert statment

I need to insert values an Internal table into a ZTABLE.
<b>INSERT ZTABLE FROM TABLE FINAL.</b>
<i>Error message:</i>
<b>The work area "FINAL" is not long enough.</b>
I have declared the structure of the internal table FINAL same as the ZTABLE. Still I am getting the error message

Hi Viven,
Try this
DATA: lit_ztable TYPE TABLE OF ztable,
INSERT ztable FROM TABLE lit_ztable               ACCEPTING DUPLICATE KEYS.
Rgds,
Prakash
<b>Rward useful answer</b>

Similar Messages

  • Syntax error in insert query

    I have a flash form that is used to inserts a record into an
    Access database table. In the for there are 4 datefields, several
    text input fields, and several select fields. When I submit the
    form, I get a syntax error that reads:
    Executing Database Query. [Macromedia][SequeLink JDBC
    Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]
    Syntax error in INSERT INTO statement.
    The error occurred on line 184. Complex object types cannot
    be converted to simple values.
    Line 184 is the last line of the Values in the insert query.
    The query looks like this:
    <CFQUERY DATASOURCE="#REQUEST.DataSource#">
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    Updated,
    ReviewDate,
    ReviewedBy,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    #FORM.SafetyChecklistDate#,
    #FORM.QCChecklist#,
    '#FORM.QCChecklistDate#',
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    #FORM.Updated#,
    #FORM.ReviewDate#,
    #FORM.ReviewedBy#,
    #FORM.Discipline#,
    #FORM.BidDate#,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    </CFQUERY>
    Any recomendations?

    Date/Time in Access provide some pretty strage hurdles. In
    many occassions I have simply changed the field to a Text field and
    ran with that and never seemed to have problems with the result. I
    didn't like doing it but I never received errors. I have been
    receiving some parameter errors with <cfqueryparam> like the
    database doesn't recognized the preceding declared field in the
    update or insert query. Here is an example of a wierd error with
    Access. I have 2 tables. One is for estimate numbers and the other
    is for sub estimate numbers that can be assigned to specific
    estimate numbers. If is actually a complicated explanation about
    what is taking place behind the doors on this. The concept is
    simple on the surface. Both tables have the same fields except the
    subestimate table has 1 extra for a user defined subestimate
    number. The only relation between the two will be the estimate
    number. This insert works fine.
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    This next one is the same exact query with the same table
    setup with one added field but kicks back a parmeter error
    expecting 4. I can't explain it.
    INSERT INTO SubEstimate(SubBidNumber,
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(#FORM.SubBidNumber#,
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    IF I get rid of the cfqueryparam fields it works. If I simply
    remove the param, I get a Syntax error. Needless to say I commented
    this query for the sake of sanity for the time being.

  • Syntax error in INSERT STATEMENT

    A problem on the date part of the query but why I don´t
    know, Thanks for any pointers,
    TIA
    <cfquery name="update1" datasource="trevor_SecurityDB">
    INSERT INTO imagesproducts
    (title, info, date)
    VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
    </cfquery>
    Error Occurred While Processing Request
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    INSERT INTO statement.
    The error occurred in uploadmember.cfm: line 28
    26 : INSERT INTO imagesproducts
    27 : (title, info, date)
    28 : VALUES ( '#form.title#', '#form.info#',
    '#DateFormat(Now())#' )
    29 : </cfquery>
    30 :
    SQL INSERT INTO imagesproducts (title, info, date) VALUES (
    'News test', 'Testing news info', '12-Jul-07' )
    DATASOURCE trevor_SecurityDB
    VENDORERRORCODE -3502
    SQLSTATE 42000

    Perhaps it is a reserved word issue with the date column,
    since
    date is an ODBC Reserved Keyword. You might try enclosing it
    within brackets [ ].
    <cfquery name="update1" datasource="trevor_SecurityDB">
    INSERT INTO imagesproducts
    (title, info, [date])
    VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
    </cfquery>
    Or, if that doesn't help, you might try using a cfqueryparam
    tag for the '#DateFormat(Now())#' value using a cfsqltype =
    "CF_SQL_TIMESTAMP" (assuming a date/time datatype on the column).
    Also, you might look into using one of the CreateODBCDateTime() or
    CreateODBCDate() functions.
    Phil

  • Error in insert statment in pl/sql

    Hi all,
    How i Execute Insert statment in Pl/Sql
    SQL> DECLARE
    2 tablename varchar2(30);
    3 Begin
    4 begin
    5 select table_name into tablename from user_tables
    6 where table_name=upper('t_calling');
    7 EXCEPTION
    8 WHEN no_data_found then
    9 execute immediate 'create table t_calling(F_CODE number,
    10 F_CALLING varchar2(50))';
    11 INSERT INTO T_Calling VALUES (1, 'asd');
    12 end;
    13 -- --------------------------
    14 Commit;
    15 End;
    16 /
    INSERT INTO T_Calling VALUES (1, 'asd');
    ORA-06550:
    PLS-00201: identifier 'T_CALLING' must be declared
    ORA-06550:
    PL/SQL: SQL Statement ignored
    Thanks
    alaa

    You are creating this table with an execute immediate statement. Which suggests that it doesn't exist yet. Therefore your insert statement is referencing a non-existent table so naturally it won't compile.
    If you really want to do this you should put the insert into an execute immediate statement as well. However, I recommend that you don't do this - it is very bad practice to put this sort of processing in the exception handler. Why? Well, what happens if the table T_CALLING already exists? The exception's got no where to go, so your program fails with an Unhandled Exception error.
    HTH, APC

  • Syntax error in insert into

    Hi,
    I'm new to coldfusion and was doing a practice survey. I'm
    getting the following error:
    The INSERT INTO statement contains the following unknown
    field name: &apos;recipes&apos;. Make sure you have typed
    the name correctly, and try the operation again.
    The error occurred in (coldfusion form): line 405
    403 :
    (lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
    404 : values
    405 :
    ('#lname#','#fname#','#yourID#','#status#','#preprog_survey#','#recipes#','#activity#','# tips#','#stress#','#other#','#othertext#','#weight_result#','#lbs_gained#','#lbs_lost#','# behaviors#','#desc_behaviors#','#most_help#','#improve_prog#')
    406 : </cfquery>
    407 :
    SQL Insert into maintaint
    (lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
    values ('last name','first
    name','444444','member,'No','0','0','1','0','1','no work, all
    play','gained',' too many','','Yes','Dreaming of eating better, but
    not doing it','This survey!','no improvement suggestions'
    VENDORERRORCODE -3502
    SQLSTATE 42000
    Can anyone tell me what this possibly means? I'm sure its
    probably hard to understand without seeing the form. These are the
    types of fields each are:
    lname, fname, yourID = text
    status = radio
    preprog_survey = radio
    recipes, activity,tips, stress, other, = checkboxes
    othertext, = text
    weight_result, = radio
    lbs_gained,lbs_lost, = text
    behaviors, = radio
    desc_behaviors, most_help, improve_prog = text

    Looking at the code you supplied I noticed that for the
    checkboxes values where '0' and '1'.
    SQL Insert into maintaint
    (lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
    values ('last name','first
    name','444444','member,'No','0','0','1','0','1','no work, all
    play','gained',' too many','','Yes','Dreaming of eating better, but
    not doing it','This survey!','no improvement suggestions'
    You don't need quotes around numeric values, only text.
    Hope that helps you.

  • Getting syntax error when i using INSERT command

    Hi,
    i am using MS Access DB. Table name is "Timesheet". the table has the following Fields,
    uname - Text
    date - Text
    intime - Text
    outtime - Text
    duration - Text
    desc - Text
    i am using preparedStatment,
    String accessDBURLPrefix = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    String accessDBURLSuffix = ";DriverID=22;READONLY=false}";
    String filename="D:\\TimeSheet\\TimeDB.mdb"
    String databaseURL = accessDBURLPrefix + filename + accessDBURLSuffix;
    Connection con = DriverManager.getConnection(databaseURL);
    PreparedStatment st = con.prepareStatement("INSERT INTO (uname, date, intime) TimeSheet VALUES (?,?,?)");
    st.setString(1,user);
    st.setString(2,date);
    st.setString(3,intime);
    st.executeUpdate();
    }if i am going to compile this code i will get SQLException
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
         at TimeSheetDemo.writeToDB(TimeSheetDemo.java:84)
         at TimeSheetDemo.main(TimeSheetDemo.java:37)
    Really i have tired to figure out this problem. please help me anyone.
    thank you

    Thank you. it was my careless mistake. i changed that mistake. but still it is not working, get same exception.
    st = con.prepareStatement("INSERT INTO  TimeSheet (uname, date, intime) VALUES (?,?,?)");suppose, if i will give values for all fields, it will work fine, example
    st = con.prepareStatement("INSERT INTO  TimeSheet  VALUES (?,?,?,?,?,?)");
    st.setString(1,user);
    st.setString(2,date);
    st.setString(3,intime);
    st.setString(4,outtime);
    st.setString(5,duration);
    st.setString(6,descrip);
    st.executeUpdate();But my problem is i want to insert the values for only 3 fields.
    give me the solution for inserting values for specified fields

  • Error while inserting into ms access using jsp

    i am using the following code to insert values from textboxes into access database
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(url);
              Statement stmt=con.createStatement();
              //ResultSet rs = null;
              //String sql = ("INSERT INTO co-ords VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ");
              String sql = "INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ";
              out.println(sql);
              stmt.executeUpdate(sql);
    the output i get is
    INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('cck','28.656529681148545','77.23440170288086','28','77','39','14','23.508','3.8472') Exception:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    can somebody help me?

    Simple,
    Some error in your query right. Unable to understand Quotation stuff.
    Well understand it properly else error will follow forever :)
    Without String, Straight Away Values
    stmt1.executeUpdate("insert into Login_Details values('Example','Exmaple')");This is the query with Login_Id Pass_Word String containing the value
    stmt1.executeUpdate("insert into Login_Details values('"+Login_Id+"','"+Pass_Word+"')");Then storing sql as string and pass it in executeUpdate(sql)
    String sql="insert into Login_Details values ('example','example') "String + Values in String
    String sql="insert into Login_Details values ('"+example+"','"+example+"') "Just first it . Hope this reply solve ur SQL EXCEPTIONG
    Sachin Kokcha

  • [Microsoft][ODBC Microsoft Access Driver] Syntax error

    I am new to Java. I have tried to write a simple program insert table in Access2002. However, I got the following error,
    ERROR: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
    My code is as follows,
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    public class dateconv3 {
    public static void main (String[] args) {
    //Setting up the JDBC-ODBC bridge connection
    String DRIVER_NAME = "sun.jdbc.odbc.JdbcOdbcDriver";
    String CONNECTION_URL = "jdbc:odbc:book1";
    // The JDBC Connection Object
    Connection con = null;
    // The JDBC PreparedStatement object
    PreparedStatement ps = null;
    boolean rc = false;
    try { // try under for loop
    // Get an connection
    Class.forName(DRIVER_NAME).newInstance();
    con = DriverManager.getConnection(CONNECTION_URL);
    SimpleDateFormat formatter = new SimpleDateFormat ("yyyy/mm/dd");
    java.util.Date currentTime_1 = new java.util.Date();
    String dateString = formatter.format(currentTime_1);
    ParsePosition pos = new ParsePosition(0);
    java.util.Date currentTime_2 = formatter.parse(dateString, pos);
    java.sql.Date dCurDate=new java.sql.Date(currentTime_2.getTime());
    System.out.println(dCurDate);
    String userid = "1";
    String booktitle = "Java Servlet Programming";
    int amount = 202;
    String sqltxt="INSERT INTO TRANSLOG ( userid, booktitle, date, amount ) VALUES (?,?,?,?)";
    // Create a statement object that we can execute queries with
    ps = con.prepareStatement(sqltxt);
    ps.setString(1, userid);
    ps.setString(2, booktitle);
    System.out.println(currentTime_2);
    java.sql.Date sqlDate = new java.sql.Date(currentTime_2.getTime());
    System.out.println(sqlDate);
    ps.setDate(3, sqlDate);
    ps.setInt(4, amount);
    System.out.println("INSERT into translog table");
    // Execute the statement
    ps.execute();
    rc = true;
    } catch (Exception ex) {
    // Sent the error
    System.out.println("ex.getMessage() print: " + ex.getMessage());
    } finally {
    try {
    if (ps != null) {
    ps.close();
    if (con != null) {
    // Put the connection back into the pool
    con.close();
    } catch (Exception ex) {
    // Ignore any error here
    The Access has been set to the date format yyyy/mm/dd and I got the following result.
    java dateconv3
    2001-01-04
    Thu Jan 04 00:56:00 CST 2001
    2001-01-04
    INSERT into translog table
    ex.getMessage() print: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
    Please advise. I got frustrated with such a silly question. Anybody can help me to resolve it.
    Patrick

    INSERT INTO TRANSLOG ( userid, booktitle, date, amount ) VALUES (?,?,?,?)I don't have Access on my computer at home here, but it is quite possible that "date" is a reserved word in Access's version of SQL. If you can change the column name, I'd recommend you do that. Otherwise try changing your SQL code to this:
    INSERT INTO TRANSLOG ( userid, booktitle, [date], amount ) VALUES (?,?,?,?)
    But be warned that this [trick] doesn't work with other databases.

  • Syntax eror in INSERT INTO satement

    I get this when i try to insert information in the database:
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    INSERT INTO statement.
    thanks for the help in advanced

    Epid3mik
    > I get this when i try to insert information in the
    database:
    I suspect some of your column names are reserved keywords,
    such as FROM, TIME, etcetera.
    http://support.microsoft.com/kb/286335
    Whenever possible, avoid using keywords as object names. The
    better solution here is to permanently rename the columns that are
    keywords. Assuming the rest of your query syntax is correct, that
    should fix the syntax error. If for some reason you cannot rename
    the columns, you must escape them by using square brackets around
    the column names:
    INSERT INTO Message ( mem_id, [From], [Time], .... )
    As an aside, you should properly scope your variables.
    Example use #FORM.mem_id# instead of just #mem_id#. Your should
    also consider using cfqueryparam for all query values. These last
    two things are not the cause of your error, but they are good
    coding practices.

  • Can anyone spot the syntax error?

    I've been looking at this for about a day now and can't see the error, which is:
    Insert Failed: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
      public String addSaleList(SaleList sL) {
        try {
          //Gets the connection to customer database.
          Class.forName(Driver);
          Connection myCon = DriverManager.getConnection(Url);
          System.out.println(sL.saleListID + " " + sL.saleID + " " + sL.product
                             + " " + sL.number);
          String sqlQry = "INSERT INTO salelist(saleID, product, number)" +
              "VALUES(?,?,?)";
          PreparedStatement myStmt = myCon.prepareStatement(sqlQry);
          myStmt.setInt(1, sL.saleID);
          myStmt.setString(2, sL.product);
          myStmt.setInt(3, sL.number);
          myStmt.executeUpdate();
          return "Sale confirmed";
        catch (Exception e) {
          System.out.println("Insert Failed: " + e);
          return ("Insert Failed: " + e);
      public class SaleList {
        public int saleListID;
        public int saleID;
        public String  product;
        public int  number;
        public SaleList(int saleListID, int saleID, String product, int number) {
          this.saleListID = saleListID;
          this.saleID = saleID;
          this.product = product;
          this.number = number;
      SaleList saleL = new SaleList(0,10,"b",2);
      lblStatus.setText(sM.addSaleList(saleL));

    Hey this is the stack trace:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execut(JdbcOdbcPreparedStatement.java:214)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdateJdbcOdbcPreparedStatement.java:136)
         at myproject.SaleModel.addSaleList0 120 a 1
    (SaleModel.java:69)
         at myproject.SalesGUI.actionPerformed(SalesGUI.java:395)
         at java.awt.Button.processActionEvent(Button.java:382)
         at java.awt.Button.processEvent(Button.java:350)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • SQLException syntax error in query

    I am baffled and hoping that maybe you can spot an error in my query - I can't seem to find it!
    The query is:
    INSERT INTO CreditCard (userID, type, name, number, expiration, addressID) VALUES (5, 1, 'Bill', '1264', 2004-04-10, 9)
    And in code it is:
    String sql = "INSERT INTO CreditCard (userID, type, name, number," + " expiration, addressID) VALUES (" + userId + ", " + type + ", \'" + name + "\', \'" + number + "\', " + expiration + ", " + addressId + ")";
    I keep getting error for this line:
    stmt.execute(sql);
    with the following message:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3065)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
    at jauction.server.CreditCardImpl.<init>(CreditCardImpl.java:65)
    at jauction.server.CreditCardTest.main(CreditCardTest.java:14)
    Do you spot the syntax error in the query? Is there any other reason why I could be getting this error?
    Similar INSERT INTO queries have been implemented and tested in this project of mine and they are working fine. I am baffled as to where the syntax error is in this query. If you spot it - could you point it out? Thanks.

    Thanks man, you saved me hours of debugging.
    I had an Access table with a column named TimeStamp, just couldn't get the damn thing to work. But I think both our problems are JDBC/SQL related, not Access related. In other words, it wouldn't work on any other RDBMS system either.
    Someone should put it in the documentation somewhere that using SQL datatype names for column names is a no-no.

  • CMP bean : 'create' method fails - SQL Syntax error

    I'm using SilverStream 3.7.3 server on Win 2K.
    In a CMP entity bean, call to any create method ( default using primary key or with any other list of parameters ) fails , giving this error :
    javax.ejb.CreateException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    <<no stack trace available>>
    I've doubly checked for mismatch between types of database columns & parameters passed, but there is no difference. ( Another BMP bean uses same types and it's working perfectly )
    Interestingly, the 'finder' & other business methods are working without any problem.
    Any idea about cause of this error / options to solve / get around the prob?
    TIA,
    Subodh

    Hi,
    See if you can get SilverStream to give you the JDBC statements it is sending to Access. If SilverStream can't do that, try using P6Spy to get hold of the JDBC. Once you have the SQL, you should be able to figure out where the prolbem is... and if you can do anything about it.
    Does access actually accept any form of Standard SQL?
    Daniel.

  • Frustrating syntax error:cfqueryparam

    I must be brain dead. I have been looking at this code for about 45 minutes trying to figure out where the syntax error is. I think it is in one of the "," but I have rearranged them so many times I am going bonkers. Can someone find where my error is.
    <cfquery name="addRegistration" datasource="RBDS">
    INSERT INTO
         tournamentReg
            (tDate
            ,tName
            ,regDateTime
            ,regNumber
            ,regFName
            ,regLName
            ,streetAddr
            ,cityStateZip
            ,regPhone
            ,regEmail
            ,lastBook
            ,usbcCard
            ,regNotify
            ,regReturn
            ,regMembership
            ,regLeague
            <cfif tName EQ #URL.tName# AND 'doubles' IS 'yes'>
            BowlerTwoName, BowlerTwoBook
            </cfif>
            <cfif tName EQ #URL.tname# AND 'threePerTeam' is 'yes'>
            BowlerTwoName, BowlerTwoBook,
            BowlerThreeName, BowlerThreeBook
            </cfif>
            <cfif tName EQ #URL.tname# AND 'fourPerTeam' IS 'yes'>
            BowlerTwoName, BowlerTwoBook,
            BowlerThreeName, BowlerThreeBook,    
            BowlerFourName, BowlerFourBook
            </cfif>
            <cfif tName EQ #URL.tname# AND 'fivePerTeam' IS 'yes'>
            BowlerTwoName, BowlerTwoBook,
            BowlerThreeName, BowlerThreeBook,    
            BowlerFourName, BowlerFourBook,
            BowlerFiveName, BowlerFiveBook
            </cfif>)
        VALUES
            VALUES
            <cfif tName EQ #URL.tname# AND 'doubles' IS 'yes'>
                     <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
                </cfif>
                <cfif tName EQ #URL.tname# AND 'threePerTeam' is 'yes'>
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
                </cfif>
                <cfif tName EQ #URL.tname# AND 'fourPerTeam' IS 'yes'>
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourBook#">
                </cfif>
                <cfif tName EQ #URL.tname# AND 'fivePerTeam' IS 'yes'>
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFiveName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFiveBook#">
                </cfif>
               ,<cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">
                   ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">
                   ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
    </cfquery>
    Error Dump states the error is on line 151 (above). Until I added the <cfif>'s it worked fine. BTW- the <cfif>'s work find until it processes the VALUE.
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    The error occurred in C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 151
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 29
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 28
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 1
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 151
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 29
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 28
    Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 1
    149 :                 <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
    150 :                 <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
    151 :                 <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
    152 :               
    153 :         )

    Hey Dan. Thanks for the tips yesterday. I went back to the version of the code when it worked. The working code is at the top. The non-working code is at the bottom. It starts not working when I include the CFIF's. I am not sure I understand your other suggestion. But maybe if you take a look at the difference between the working code and the other you can see what I don't.
    Working CODE:
    <cfquery name="addRegistration" datasource="RBDS">
    INSERT INTO
         tournamentReg
            (tDate
            ,tName
            ,regDateTime
            ,regNumber
            ,regFName
            ,regLName
            ,streetAddr
            ,cityStateZip
            ,regPhone
            ,regEmail
            ,lastBook
            ,usbcCard
            ,regNotify
            ,regReturn
        VALUES
                      <cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">
                    ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">
                    ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">
    </cfquery>
    PRODUCES THIS:
    CONGRATULATIONS YOU ARE NOW REGISTERED FOR THE
    SUPER NO-TAP 
    WHO TO CONTACT: Rick Rossiter  -  TELEPHONE: 775-813-5492 
    The table below contains all of the information you entered for the Super No-Tap tournament.
    All the information you entered to register for this tournament is displayed bwlow. Reno Bowls wishes you the best of luck in this tournament. If there is any information below that is incorrect, please inform us as soon as possible by calling Reno Bowls or sending us an email to: [email protected]. Please make certain to include your registration number (8701967) when making any inquiries.
    YOUR REGISTRATION NUMBER
    8701967
    TIME AND DATE YOU REGISTERED
    02/17/10 - 1:02:09 PM
    DATE OF TOURNAMENT
    2009-12-13 00:00:00.0
    WHERE THE TOURNAMENT WILL BE
    High Sierra Bowling Lanes
    3390 South Virginia Street
    Reno, NV, 89502-4502
    (775) 825-1048
    DIRECTONS
    TIME TOURNAMENT BEGINS
    12:00 PM
    YOU SAVED $5.00 BY REGISTERING ONLINE
    $25
    CAPTAIN'S NAME (FIRST REGISTRANT)
    Rick Rossiter
    YOUR MAILING ADDRESS:
    105 N. McCarran Blvd.
    Reno, NV 89523
    YOUR EMAIL ADDRESS IS:
    [email protected]
    YOUR PHONE NUMBER IS:
    813-0850
    YOUR LAST YEARS BOOK AVERAGE IS:
    191
    YOUR USBC MEMBER NUMBER IS:
    8130-5041
    NOTIFY YOU OF FUTURE TOURNAMENTS
    Yes
    RETURNING RENO BOWLS PLAYER
    welcome back and thank you
    Reno Bowls, A NexTeam LLC Company (c) 2009-2010
    The NON-WORKING CODE: Even though I removed the CFIF structure. However, I have to be able to discern the number of bowlers according to the tournament the registrant is entering.
    <cfquery name="addRegistration" datasource="RBDS">
    INSERT INTO
    tournamentReg
            (tDate
            ,tName
            ,regDateTime
            ,regNumber
            ,regFName
            ,regLName
            ,streetAddr
            ,cityStateZip
            ,regPhone
            ,regEmail
            ,lastBook
            ,usbcCard
            ,regNotify
            ,regReturn
            ,regMembership
            ,regLeague
    VALUES
                   <cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">,
                   <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
                   <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
    </cfquery>
    According to the dump the "," syntax is incorrect, but it looks fine to me. What am I missing?
    Error Occurred While Processing Request
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    The error occurred in C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 168
    166 :                     <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
    167 :                     <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
    168 :                     <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
    169 :               
    170 :         )
    SQL
       INSERT INTO tournamentReg (tDate ,tName ,regDateTime ,regNumber ,regFName ,regLName ,streetAddr ,cityStateZip ,regPhone ,regEmail ,lastBook ,usbcCard ,regNotify ,regReturn ,regMembership ,regLeague VALUES ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param 6) , (param 7) , (param 8) , (param 9) , (param 10) , (param 11) , (param 12) , (param 13) , (param 14) , (param 15) , (param 16) )
    DATASOURCE
      RBDS
    VENDORERRORCODE
      -3502
    SQLSTATE
      42000

  • Where is the syntax error in my Insert statement?

    It says that there is a syntax error in my insert statement, pointing to the .ExecuteNonQuery() at the end:
    'Defining the activity ID from the datatable
    Dim ActivityID As Integer = DataTableActivities.Rows(0).Item(0)
    'Defining the calories from the datatable
    Dim calories As Decimal = (DataTableActivities.Rows(0).Item(3)) * (DurationNum.Value / 60)
    'Insert statement to add new training events
    Dim SqlQueryActivityInsert As String = "INSERT INTO tblTraining (RunnerID, ActivityID, Full_Name, Time, Calories_Burnt, Date) VALUES (@RunnerID, @ActivityID, @Full_Name, @Time, @Calories, @Date)"
    Dim SqlCommandActivity As New OleDbCommand
    With SqlCommandActivity
    .CommandText = SqlQueryActivityInsert
    .Parameters.AddWithValue("@RunnerID", LoginForm.UserIDlbl.Text)
    .Parameters.AddWithValue("@ActivityID", ActivityID)
    .Parameters.AddWithValue("@Full_Name", LoginForm.Full_Namelbl.Text)
    .Parameters.AddWithValue("@Time", DurationNum.Value)
    .Parameters.AddWithValue("@Calories", calories)
    .Parameters.AddWithValue("@Date", WeekPicker.Value)
    .Connection = conn
    .ExecuteNonQuery()

    Viorel is right.  The 'Date' field is probably throwing it off.  Date is a reserved word. 
    https://www.drupal.org/node/141051
    Putting square brackets [] around the field name should get it working for you.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Syntax error, insert "}" to complete Class body.

    Hello everyone,
    I am trying to create simple Adobe form with WebDynpro for java. Java error in autogenerated class appears "Syntax error, insert "}" to complete Class body". As I see, java class really corrupted - there are no "}" at the class end.
    Really appreciate any help.
    Kirill

    It dissappeared.

Maybe you are looking for

  • Java Plug-In's SSV Helper 2, Start Detector - are not Verified

    I have the following Internet Explorer Add-ons relating to Java... I had an old version of Java, something like 1.5 or 1.15 ? - it was from 2006... then i installed the latest version of java from the official java website (where i had to say yes to

  • Stock Posting date in QA11

    Hi, Usage decision is made through TCode QA11.In QA11 we also make stock posting. There is one screen that is document header data, in which system take by defalt current date for the document date and posting date. In our case there is gap between G

  • Division and Profit Centre Relationship?

    Hi, Is anyone able to provide a definition of the objects DIVISION and PROFIT CENTRE and also what their relationship is with each other? Thanks, M.

  • Hyperlinks, scrollable text frames, and Multistate objects

    I have a DPS layout with a scrollable text frame on one side, and a multistate object (MSO) on the other. I want to be able to hyperlink parts of the text in the text frame to specific states in the MSO. How do I do this?

  • A method layout without a target object causes a one-sided reclassificat.

    Dear experts, I am from BI background. I have been asked to do a testing in BCS and received the following message when I tried to generate NPAT: A method layout without a target object causes a one-sided reclassificat. Message no. UCF4008 Diagnosis