left outer join in odbc problem

  • SELECT listofFields

    FROM fTable f LEFT OUTER JOIN

    flTable fl ON f.gen_files = fl.gen_Files INNER JOIN

    faTable fa ON f.gen_files = fa.gen_files INNER JOIN

    fgsTable fgs ON f.gen_files = fgs.gen_files

    WHERE (f.files_path = 'D:\entirepath\withFile.bmp')

    This query runs without problem in Microsoft 2003 SQL Server.

    If I use the query in an asp page and call using odbc the query fails with an error: "Incorrect syntax near '='

    What syntax allows left outer join and inner join statments in the same query?

  • Most likely because of the single quote marks when you feed it in the asp script.

    Try

    (f.files_path = ' + char(39) + 'D:\entirepath\withFile.bmp' + char(39) + ')'



    ----------------
    Jim P.

    A little bit of this and a little byte of that can cause bloatware.

  • I would check the query that you build on the ASP page to ensure that the syntax is still correct.  Populate it in a message box or better still a text box that you can copy/paste it into QA and see if the syntax is still correct.

    The code listed above looks ok

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • If I response.write the sql string generated by the code and copy and paste into query analyzer, the query runs without fail.  The problem is not the single quotes and I can successfully test the string outside of obtaining the recordset via odbc. 

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply