Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to show months from a sql view

Posted on 2008-09-29
7
Medium Priority
?
233 Views
Last Modified: 2010-04-21
I have a view that shows invoicing data from the past through today's date.  I used a datepart function to seperate the month out from the date of the invoice, however, it comes out as 1 through 12.  Is there a way to get the month to show up as either March or Mar vs. 3?
Thanks,
JoMar
0
Comment
Question by:JoMar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 1200 total points
ID: 22600610
select datename(m, datefield)
from yourtable
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 600 total points
ID: 22600611
check out DATENAME(month, yourdatefield) instead.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22600633
angelIII, are you suggesting that m in the datepart function doesn't work?  By the time difference of our responses I doubt that you are, just making sure.  :)
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 6

Assisted Solution

by:RemcovC
RemcovC earned 200 total points
ID: 22600659
@chapmandew

The syntax is: DATENAME ( datepart , date )
and the datepart for a month can either be m, mm, month

see: http://msdn.microsoft.com/en-us/library/ms174395.aspx
0
 

Author Closing Comment

by:JoMar
ID: 31501366
Thanks to all - I awarded the most points to chapmandew since his came in first and was correct.  I also awarded some to angellll since he had the same thing and was also correct.  And I awarded som to RemcovC for the syntax information.  Great job to all and thanks.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22600744
>angelIII, are you suggesting that m in the datepart function doesn't work?  
as you assumed, I was responding to the questioner, and had not seen your post until I posted...
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22601826
RemcovC, Yes, I'm aware.  Thank you.  :)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question