Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 12:41:15
|
Trying to use datename to give me both month and year, example11-18-2004 is current dataI want it to show November 2004. |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 12:50:17
|
This might work I guess:select datename(month,dbo.juliandate(JULDATE)),datename(year,dbo.juliandate(JULDATE)) from MAUDIT??? |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-11-17 : 13:23:43
|
what's wrong with this:declare @date datetimeset @date = '20041118'select datename(m, @date) + ' ' + convert(char(4), year(@date)) Go with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp |
 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 14:07:31
|
Getting closer, except that 20011118 is really just one instance, I want the logic to apply to 2000 rows of data. Somewhat new to sql, sorry if this is an easy to solve |
 |
|
samssb
Starting Member
10 Posts |
Posted - 2006-11-17 : 14:15:56
|
select datename(m, yourdatecolumn) + ' ' + convert(char(4), year(yourdatecolumn))from yourtable |
 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 14:21:56
|
I should of included more information in original post, I am getting the date from the following function first:convert(char,dbo.juliandate(JULDATE),110), is it as easy as plugging that in as the column name cause it doesnt seem to be working:select datename(m,(convert(char,dbo.juliandate(JULDATE),110)) from MAUDIT |
 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 15:09:32
|
I believe I found my issue, I was missing a ) |
 |
|
|
|
|
|
|