dbTalk Databases Forums  

Converting a date field to the month

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Converting a date field to the month in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
lisa.moffitt@gmail.com
 
Posts: n/a

Default Converting a date field to the month - 03-30-2007 , 04:51 PM






How can I create a field in a view that takes a date field and
converts it to a month?
For instance, if I have a field called "CreatedOn" with a date of
'2/22/2007', how can I create another field called "Month" that will
say "February"? Is there a built-in SQL function that does this (like
using CONVERT) or do I need to write my own?

Thanks!
Lisa


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Converting a date field to the month - 03-30-2007 , 05:34 PM






(lisa.moffitt (AT) gmail (DOT) com) writes:
Quote:
How can I create a field in a view that takes a date field and
converts it to a month?
For instance, if I have a field called "CreatedOn" with a date of
'2/22/2007', how can I create another field called "Month" that will
say "February"? Is there a built-in SQL function that does this (like
using CONVERT) or do I need to write my own?
Look up datename in Books Online.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.