Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

Build Date string

I have a stored procedure that has the year input, like so:
@Year int

I need to build a string using this year. Supposing @Year is 2012, I need a string that is:
12-31-2012
The month/date is always 12-31
How do I do this?
Avatar of Sean Stuber
Sean Stuber

@yourdate = '12-31-' + @Year
Avatar of allelopath

ASKER

Declare @MyDate varchar
Set @MyDate = '12-31-' + @Year

gives this error:
Conversion failed when converting the varchar value '12-31-' to data type int
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

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