Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

How to split the date format into month with year? Expand / Collapse
Posted Wednesday, January 1, 2014 8:09 AM



Group: General Forum Members
Last Login: Today @ 6:24 AM
Points: 23,522, Visits: 37,765
Jeff Moden (12/31/2013)
Lynn Pettis (12/31/2013)
Assuming this is still true: billed_date datetime

right('0' + cast(month(billed_date) as varchar(2)),2) + '-' + cast(year(billed_date) as varchar(4))

... or...


To the OP: And you can learn about COVERT and the different format codes it accepts by reading Books Online as well.

Remember, Books Online can be your friend.

Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1526907
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse