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 2005 Forums
 Transact-SQL (2005)
 sqlserver2000. Please help with a syntax.

Author  Topic 

SQLSERVER2011
Starting Member

1 Post

Posted - 2011-03-16 : 19:13:32

Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'as'.




Select top 50

DATEADD ( ss , ActionDate, '1970-01-01') as actiondate ,
count(distinct (convert (char(10),DATEADD ( ss , ActionDate, '1970-01-01'),112)) as numberofcalls

from dbo.historyactions

where (DATEADD ( ss , ActionDate, '1970-01-01')

between '2010-01-01' and '2010-12-31'

and actionid = 70000

group by (DATEADD ( ss , ActionDate, '1970-01-01'))

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-03-16 : 21:39:45
Couple of missing brackets - see in red below:
quote:
Originally posted by SQLSERVER2011


Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'as'.




Select top 50

DATEADD ( ss , ActionDate, '1970-01-01') as actiondate ,
count(distinct (convert (char(10),DATEADD ( ss , ActionDate, '1970-01-01'),112)) ) as numberofcalls

from dbo.historyactions

where (DATEADD ( ss , ActionDate, '1970-01-01'))

between '2010-01-01' and '2010-12-31'

and actionid = 70000

group by (DATEADD ( ss , ActionDate, '1970-01-01'))


Go to Top of Page
   

- Advertisement -