Link to home
Start Free TrialLog in
Avatar of Galina Besselyanova
Galina Besselyanova

asked on

combining date with string as a parameter in sql filter

Hello,

I am trying to put a filter in sql 2008 view for the date field. I have the current year year(getdate()) and I need to use a string '8/31/' as a permanent month and day so the parameter will be '8/31/2013' and the next year '8/31/2014'. I am trying to do this
 '8/31/'+year(getdate()) but getting an error "Conversion failed when converting the varchar value '8/31/' to datatype int." How  I can write it correctly?
ASKER CERTIFIED SOLUTION
Avatar of deast05
deast05
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Galina Besselyanova
Galina Besselyanova

ASKER

Great, Thank you very much.
Avatar of PortletPaul
or you can use "datename" which returns a character string

select '8/31/' + datename(year,getdate() )