Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Access query doesn't work in SQL server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-07 : 10:00:30
Shahid writes "Helo Gurus;
I have a query that runs fine in MS Access app. but using the same table in SQL server , the query fails. The query is:

SELECT *
FROM SubType
WHERE [SubType]=4 And [ProductID]=0
ORDER BY [EntityID]=0, [EntityID] DESC , ([FormatCode]=' '), ([FormatCode]='ET') DESC , [FormatCode];

I get Syntex error line 4, error near '='

Please ignore the fact that name of the table is similar to name of one if its column. Problem is that ORDER BY doesn't like '=' sign. Any work around.

Thanks a lot experts.."

Nazim
A custom title

1408 Posts

Posted - 2002-05-07 : 10:11:43
i dont understand what you are trying to do by assigning = in order by clause?

newayz, if you are trying to check for those records which match those conditions.

Try this

SELECT *
FROM SubType
WHERE [SubType]=4 And [ProductID]=0 and ([FormatCode]=' '
and [EntityID]=0

ORDER BY [EntityID] DESC , ),[formatcode] DESC ;

or Still if you want to sort it dynamically depending on the conditions met.

Read this Article http://www.sqlteam.com/item.asp?ItemID=2209 .

HTH

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -