Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: Missing semicolon(;) at end of SQL statement

    I received an error message
    "Missing semicolon( at end of SQL statement"

    sub
    dim a(12,20) as integer
    dim b(12) as string

    For intRow = 0 To 12 Step 1

    StrSQL = "INSERT INTO tblRGAAnalysis (Quarter) Values (""" & b(intRow) & """);

    db.Execute StrSQL

    For i = 0 To 19

    StrSQL = "INSERT INTO tblRGAAnalysis(" & i & ") Values(" & a(intRow, i) & ") "

    StrSQL = StrSQL & "WHERE a(intRow) = b(intRow);"
    ''' ***Error occured here ***

    db.Execute StrSQL


    Next i
    Next intRow

    end sub

    The first INSERT INTO statement is fine but not the second.
    Can't see why

    Thanks!!

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251

    Re: Missing semicolon(;) at end of SQL statement

    dude, before you send it to SQL engine, look at it. If you have huge SQL it is good to debug it and copy strSQL to QUERY and try to run it that way....


    error is in StrSQL = StrSQL & "WHERE a(intRow) = b(intRow);"

    it should be (maybe) like this

    StrSQL = StrSQL & "WHERE " & a(intRow) & " = " & b(intRow) & ";"

    and I'm really not sure what you are trying to run, but it's different story. INSERT INTO with WHERE ?



    jiri
    Last edited by playernovis; 12-27-02 at 12:58.

  3. #3
    Join Date
    May 2002
    Posts
    395

    Re: Missing semicolon(;) at end of SQL statement

    Originally posted by playernovis
    dude, before you send it to SQL engine, look at it. If you have huge SQL it is good to debug it and copy strSQL to QUERY and try to run it that way....


    error is in StrSQL = StrSQL & "WHERE a(intRow) = b(intRow);"

    it should be (maybe) like this

    StrSQL = StrSQL & "WHERE " & a(intRow) & " = " & b(intRow) & ";"

    and I'm really not sure what you are trying to run, but it's different story. INSERT INTO with WHERE ?



    jiri
    I am using two arrays to populate a table. Arraya has values and arrayb contains the dates. I want the WHERE in the SQl string to verify arraya and arrayb are in the same row(intRow). I just want the row location of the arrays not the values in them.
    This is not how you would write it?

  4. #4
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    in your case INSERT INTO inserts ONE row into table, if you want to make condition if to insert the row into table, why don't you use IF statement before the db.EXECUTE?
    IF arraya <> arrayb then
    db.execute .....
    end if


    jiri

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •