?
Solved

I would like to display date fields as year and month only

Posted on 2011-10-24
2
Medium Priority
?
206 Views
Last Modified: 2012-05-12
I have a date field that will display as 2011-01-01, but would like to display it like this 2010-Jan.
0
Comment
Question by:Jintonix415
2 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 2000 total points
ID: 37022019
Something like this perhaps:
CAST(DATEPART(YEAR, GETDATE()) AS char(4)) + '-' + LEFT(DATENAME(MONTH, GETDATE()), 3)

Open in new window

0
 

Author Comment

by:Jintonix415
ID: 37022063
Yes, that worked flawlessly. Thanks again!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

862 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