Results 1 to 4 of 4

Thread: SQL error (resolved)

  1. #1

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    SQL error (resolved)

    Does anyone see anything wrong with this sql statement? I'm getting a syntax error on the last join

    VB Code:
    1. strMySQL = ""
    2.     strMySQL = strMySQL & "INSERT INTO usys_temp_exception_list "
    3.     strMySQL = strMySQL & "( user_id"
    4.     strMySQL = strMySQL & ", exception_id )"
    5.     strMySQL = strMySQL & "SELECT " & CurrentUserInfo.lngUserID & " AS user_id"
    6.     strMySQL = strMySQL & ", [Exception Condition Reports].[Exception ID] AS exception_id"
    7.     strMySQL = strMySQL & " FROM ([Exception Condition Reports]"
    8.     strMySQL = strMySQL & " LEFT JOIN [Exceptions Copy History] ON [Exception Condition Reports].[Exception ID] = [Exceptions Copy History].[Exception ID])"
    9.     strMySQL = strMySQL & " LEFT JOIN [Exceptions Routing History] ON [Exception Condition Reports].[Exception ID] = [Exceptions Routing History].[Exception ID]"
    10.     strMySQL = strMySQL & " LEFT JOIN detail_exception_actions ON [Exception Condition Reports].[Exception ID] = detail_exception_actions.[Exception ID]"
    11. Debug.Print strMySQL

    Thanks in advance
    Last edited by demotivater; Apr 29th, 2004 at 04:55 PM.

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    That's not a good method... it's slow.... The less strings that you put together the better.

    Try:

    strMySQL = "INSERT INTO usys_temp_exception_list " & _
    "( user_id" & _
    "etc."

  3. #3

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Yea, I got it. That's what i ended up doing. I'm fixing someones code and the entire program is written like this, it's really a pain in the rear. Weird that I didn't really change anything though, just combined it all into one line and it worked. Oh well, screw it, it works.

    Thanks

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Yea... other's code can be confusing... improper... and just plain illogical.

    Good luck!

Posting Permissions

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



Click Here to Expand Forum to Full Width