SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Incorrect Syntax Error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

suketu9
Starting Member

13 Posts

Posted - 12/04/2006 :  12:31:20  Show Profile  Reply with Quote
I am trying to run this query but keep getting "Incorrect Syntax near keyword 'AS'. Not sure what is wrong:

select bbr_object_name,
DATEPART(day, bbr_value_date) AS 'day',
DATEPART(month, bbr_value_date) AS 'month',
DATEPART(year, bbr_value_date) AS 'year',
DATEPART(hour, bbr_value_date) AS 'hour',
avg("Value") AS 'average',
stdev("Value") AS 'stdev',
count * AS 'count'
from icBoaSwitchLastTransferFV
group by datepart(day, bbr_value_date),
datepart(month, bbr_value_date),
datepart(year, bbr_value_date),
datepart(hour, bbr_value_date),
bbr_object_name
order by year,
month,
day,
bbr_object_name

TG
Flowing Fount of Yak Knowledge

USA
5944 Posts

Posted - 12/04/2006 :  12:42:12  Show Profile  Reply with Quote
count(*)
not
count *

Be One with the Optimizer
TG
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 Posts

Posted - 12/04/2006 :  13:40:22  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Also, what is about the double quotes (") for the column name Value?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
5944 Posts

Posted - 12/04/2006 :  13:58:19  Show Profile  Reply with Quote
yeah,

My own preferences and I believe best practices are:

refer to (and alias) column names with square brackets:
select [value] as [stdev]

and only use single quotes for quoted strings (and to ESCAPE an appostrophe):
select 'O''Connell' as [LastName]

and never use double quotes in t-sql code (even though BOL examples use them)

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000