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 2000 Forums
 SQL Server Development (2000)
 Date function Error

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2003-01-20 : 18:18:28
SELECT
DATEADD(d,-1,CONVERT(DATETIME,CONVERT(char(4),YEAR(DATEADD(month,-1,getdate())))+LEFT(CONVERT(varchar,getdate(),10),2)+'01')))



got following error message

Incorrect syntax near ')'.


I couldn't figure it out what's the problem..

any help would be appreciated..


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-01-20 : 18:22:59
You've got one too many right parenthesis. Remove one:

SELECT
DATEADD(d,-1,CONVERT(DATETIME,CONVERT(char(4),YEAR(DATEADD(month,-1,getdate()))+LEFT(CONVERT(varchar,getdate(),10),2)+'01')))

Go to Top of Page
   

- Advertisement -