I have an Transact SQL query that returns a field with a date in it within a temp table. How can I get it to convert this date (in the temp table only, of course) to display ONLY month & year, no day... mmyyyy or yyyymm or some variation thereof.
The resulting data generated by the query will be transferred into an Excel spreadsheet & I want the date to be treated as such so that the months will show up in order.
This is probably VERY simple, but I am a bit new to SQL & cannot figure it out.
I have the following, but I want the year in addition to the month number.
Thanks in advance for any suggestions!
The resulting data generated by the query will be transferred into an Excel spreadsheet & I want the date to be treated as such so that the months will show up in order.
This is probably VERY simple, but I am a bit new to SQL & cannot figure it out.
I have the following, but I want the year in addition to the month number.
Code:
drop table #ESI
go
select prname,pcpteam,hfactname,count(distinct ptien)Uniq,
datepart(month,visitdate)month
into #ESI
from #fh
group by hfactname,pcpteam,prname,visitdate
go
select * from #ESI
Thanks in advance for any suggestions!