Carlo Romagnano (6/19/2013)
Richard Warr (6/19/2013)
I ran the code and got:
Msg 242, Level 16, State 3, Line 7
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.
That was in the INSERT rather than the SELECT though.
Re-run the code with "set dateformat ymd" first
other wise remove datetime
create table #Employee
insert into #Employee
select 0, '1995-01-01'
select 1, '1983-08-01'
select 2, '1948-07-31'
select 3, '1932-02-29'
select 4, '1980-06-15'
SELECT BirthMonth = CHOOSE (Month(Birthday), 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
drop table #Employee