Jul 17, 2008 #1 dolodolo Technical User May 27, 2003 86 US Hi, I am looking for the code to convert a date field to a 3-character month - e.g. JUL. Here's what I have but it's just returning the number. select convert(varchar, (datepart(mm, dtdate))) from cmrevision Any help is most appreciated. Thanks
Hi, I am looking for the code to convert a date field to a 3-character month - e.g. JUL. Here's what I have but it's just returning the number. select convert(varchar, (datepart(mm, dtdate))) from cmrevision Any help is most appreciated. Thanks
Jul 17, 2008 #2 SQLSister Programmer Jun 18, 2002 7,292 US try Code: select DATENAME(month, dtdate) "NOTHING is more important in a database than integrity." ESquared Upvote 0 Downvote
try Code: select DATENAME(month, dtdate) "NOTHING is more important in a database than integrity." ESquared
Jul 17, 2008 #3 genomon Programmer Aug 20, 2001 2,449 US Instead of DATEPART, try DATENAME and then use LEFT(name,3). "Don't be irreplaceable. If you can't be replaced, you can't be promoted." Upvote 0 Downvote
Instead of DATEPART, try DATENAME and then use LEFT(name,3). "Don't be irreplaceable. If you can't be replaced, you can't be promoted."
Jul 17, 2008 #4 genomon Programmer Aug 20, 2001 2,449 US I posted the same time as SQL Sis (so didn't see her reply)- as usual, her solution is more elegant in its simplicity, and also the way to go. "Don't be irreplaceable. If you can't be replaced, you can't be promoted." Upvote 0 Downvote
I posted the same time as SQL Sis (so didn't see her reply)- as usual, her solution is more elegant in its simplicity, and also the way to go. "Don't be irreplaceable. If you can't be replaced, you can't be promoted."
Jul 17, 2008 #5 SQLSister Programmer Jun 18, 2002 7,292 US Genomon I think you are right and dolodolo still might need to use the left function. Code: select left(DATENAME(month, dtdate),3) from cmrevision "NOTHING is more important in a database than integrity." ESquared Upvote 0 Downvote
Genomon I think you are right and dolodolo still might need to use the left function. Code: select left(DATENAME(month, dtdate),3) from cmrevision "NOTHING is more important in a database than integrity." ESquared
Jul 17, 2008 Thread starter #6 dolodolo Technical User May 27, 2003 86 US Thanks All for a great and speedy response!!!! Upvote 0 Downvote