Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MSSQL syntax problem

    This is roughly the SQL going in,

    Code:
    SELECT * FROM tblDetails WHERE Cartographer LIKE '%%%' AND Retail_Price >= 0 AND Retail_Price <= 10000000 AND Area LIKE '%%%' AND Description LIKE '%%%' AND Active=1 AND GroupID=1 ODER by Cartographer ASC
    I get back

    Code:
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Cartographer LIKE '%%%' AND Retail_Price >= 0 AND Retail_Price <= 10000000 AND Area LIKE '%%%' AND Description LIKE '%%%' AND Active=1 AND GroupID=1 ODER by Cartographer ASC'.
    Strangely, when I put in

    Code:
    SELECT * FROM tblDetails WHERE Cartographer LIKE '%%%' AND Retail_Price >= 0 AND Retail_Price <= 10000000 AND Area LIKE '%%%' AND Description LIKE '%%%' AND Active=1 AND GroupID=1 ORDER by Price ASC
    I get

    Code:
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    Ideas?

  • #2
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, ORDER should not have been in capitals.

    fixed all except the price ORDER, and that was because I was using the wrong column name...

    Moral of the story?

    Using MSSQL use order by NOT ORDER BY!! Strange that other words like WHERE are in capitals.
    Last edited by milescook; 02-15-2007 at 10:43 AM.

  • #3
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    I don't think there is a problem with capital.

    ORDER BY is working fine for me since 3 years

  • #4
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    milescook,

    If you look at your code and the error that you pasted, you'll notice that you spelled 'order' wrong (you spelled it 'oder'). It doesn't matter in SQL Server (or any other database systems) whether SQL commands are lowercase or uppercase, but they do require you to spell them correctly, haha.

    -Shane


  •  

    Posting Permissions

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