TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get month from the datatime column in SQL Server
Venkatesan Jayakantham
Jun 06, 2010
3.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Get month from the datatime column in SQL Server
DateName function in SQL Server:
DateName function will be used to fetch the data/month/year/time from the datetime column.
drop table sample_table
create table sample_table (id int, dat datetime)
insert into sample_table values(1,getdate())
select * from sample_table
select id,dat from sample_table where datename(month,dat)='June'
-----------------------------------------
id dat
-----------------------------------------
1 2010-06-07 10:54:52.607
-----------------------------------------
Cheers,
Venkatesan Prabu .J
http://venkattechnicalblog.blogspot.com/
Get month from the datatime column in SQL Server
Next Recommended Reading
Remove common substring from the strings in a column in SQL Server