Click here to Skip to main content
15,910,872 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ALL,

I have a query running in MS-Access I would like to convert the same query to MSSQL Server How to convert this query. The query is

SQL
SELECT t.[device name], t.[Disk Storage Used(GB)], t.[scan date] AS scandate
FROM [Disk Trending Report] AS t, (SELECT d.[device name], max([Scan Date]) AS scandate FROM [Disk Trending Report] AS d GROUP BY [device name], Format([Scan Date],mm/yyyy) ORDER BY [Device Name])  AS r
WHERE (((r.scandate)=[t].[scan date]) AND ((r.[device name])=[t].[device name]))
ORDER BY t.[device name], t.[scan date];
Posted
Updated 12-Dec-11 5:28am
v2
Comments
Mehdi Gholam 12-Dec-11 11:36am    
What error are you getting in mssql?
sacraj 12-Dec-11 11:44am    
Msg 1033, Level 15, State 1, Line 4
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.

1 solution

Recommendation: extract the data out of you MySQL database in a delimited file (csv) using the utf8 (unicode) character set. Import into SQL Server using bcp specifying utf8 with "-Jutf8" parameter and character mode "-c".'
 
Share this answer
 
Comments
sacraj 12-Dec-11 11:21am    
I wan to change the query ,how to change the query

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900