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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With Error

Status
Not open for further replies.

renee35

MIS
Jan 30, 2007
199
I am getting the following error when trying to write the following formulas:

SET @StartDate = cast ((@qtr*3)-2) as varchar(1))+ '/1/' + cast(@year as varchar(4)) as datetime)
SET @EndDate = cast((@qtr*3) as varchar(1)) + '/1/' + cast(@year as varchar(4)) as datetime)

Error: Incorrect syntax near the keyword 'as'.
Incorrect syntax near 'cast', expected 'AS'

Should I be using convert instead?

Any help would be greatly appreciated.

Thanks a bunch!!

-T
 
Please post in an appropriate forum - this is ntohing to do with SSRS - you have a syntax error in your SQL

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Sorry, no need to get all mad about it? We all make mistakes from time to time. If you couldn't help that's all you had to say!

Thanks a bunch!!

-T
 
I'm wasn't mad - I was being factual and stating why I was asking you to post in a different forum. I even pointed out that it was simply a syntax error - nothing to do with needing to use CONVERT

If I was mad, I wouldn't have used "please"



Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Okay, thank you very much for even responding :0).. Have a great day!!

Thanks a bunch!!

-T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top