...

MSSQL syntax problem

milescook
02-15-2007, 10:34 AM
This is roughly the SQL going in,

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

[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

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

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

Ideas?

milescook
02-15-2007, 10:40 AM
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.

SSJ
03-09-2007, 05:55 AM
I don't think there is a problem with capital.

ORDER BY is working fine for me since 3 years

TheShaner
03-19-2007, 05:34 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum