Solved

How to show months from a sql view

Posted on 2008-09-29
7
182 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
7 Comments
 
LVL 60

Accepted Solution

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

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 150 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 6

Assisted Solution

by:RemcovC
RemcovC earned 50 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 142

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now