Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting a Query With Format

Status
Not open for further replies.

dmaier

MIS
Apr 13, 2002
38
US
I am trying to convert the following Access Query to SQL. It doesn't like the term Format. I am using an asp program that was designed for Access but will work with SQL Server.

Can anyone give me some advice on how to do it? Thanks in advance.

SELECT Format([stats].[Time],'h') AS [Hour], Stats.IP, Stats.Date
FROM Stats
GROUP BY Format([stats].[Time],'h'), Stats.IP, Stats.Date
ORDER BY Format([stats].[Time],'h');




 
SELECT datepart(hh,[stats].[Time]) AS [Hour], Stats.IP, Stats.Date
FROM Stats
GROUP BY datepart(hh,[stats].[Time]), Stats.IP, Stats.Date
ORDER BY datepart(hh,[stats].[Time])

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Ok...I understand what you are saying. Well in the ASP code I am trying to convert to SQL Server, I am getting error messages with this type of statement:

sGroupBy = sGroupBy & ", Format( "& sDataSource &".Date, 'yyyy') "

Is there a way to correct this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top