all groups > sql server new users > january 2006 >
You're in the

sql server new users

group:

Convert Access query to SQL View


Convert Access query to SQL View Senthilkumar
1/31/2006 12:00:00 AM
sql server new users:
Hi,

I have used an access table to create a chart report to show how many calls
were handled in a month. How do i conver the Access sql to MS sql server
view. Here is the access sql:

SELECT (Format([ComplaintDate],"mmm"" '""yy")) AS Expr1, Count(*) AS [Count]
FROM [Complaints]
GROUP BY (Format([ComplaintDate],"mmm"" '""yy")),
(Year([ComplaintDate])*12+Month([ComplaintDate])-1)
ORDER BY (Year([ComplaintDate])*12+Month([ComplaintDate])-1);

In the MS Sql, the word FORMAT is not recognised. I have tried several ways
like this w/o any luck. Can anyone tell me the correct syntax for the above
sql querry.

Thanks

Senthilkumar


Re: Convert Access query to SQL View Tom Moreau
1/31/2006 12:00:00 AM
Check out CONVERT() in the BOL.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
[quoted text, click to view]
Hi,

I have used an access table to create a chart report to show how many calls
were handled in a month. How do i conver the Access sql to MS sql server
view. Here is the access sql:

SELECT (Format([ComplaintDate],"mmm"" '""yy")) AS Expr1, Count(*) AS [Count]
FROM [Complaints]
GROUP BY (Format([ComplaintDate],"mmm"" '""yy")),
(Year([ComplaintDate])*12+Month([ComplaintDate])-1)
ORDER BY (Year([ComplaintDate])*12+Month([ComplaintDate])-1);

In the MS Sql, the word FORMAT is not recognised. I have tried several ways
like this w/o any luck. Can anyone tell me the correct syntax for the above
sql querry.

Thanks

Senthilkumar


AddThis Social Bookmark Button