What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 19691 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > SQL Server > Search records based on particular Date in sql ...
Madhu.B.Rokkam

Search records based on particular Date in sql

 Code Snippet posted by: Madhu.B.Rokkam | Posted on: 10/26/2012 | Category: SQL Server Codes | Views: 437 | Status: [Member] [MVP] | Points: 40 | Alert Moderator   


Search records based on particular Date in sql

Select  column1, column2, createdDate from tSearchTable 

where DATEPART(month, dtmCreatedDate) = 10
and DATEPART(day, dtmCreatedDate) = 26
and DATEPART(year, dtmCreatedDate) = 2012


Thanks and Regards
Madhu
Found interesting? Add this to:


 Responses

Jasminej
Posted by: Jasminej | Posted on: 10/26/2012 | Level: Starter | Status: [Member] | Points: 10 | Alert Moderator 

What about the performance using this method ?

thank you

T.Saravanan
Posted by: T.Saravanan | Posted on: 10/28/2012 | Level: Silver | Status: [Member] [MVP] | Points: 10 | Alert Moderator 

@Madhu, Is there any problem in direct condition? like
"CONVERT(DATETIME, dtmCreatedDate, 101) = '10/26/2012'"


Thanks,
T.Saravanan

Mohaiselva
Posted by: Mohaiselva | Posted on: 11/2/2012 | Level: Starter | Status: [Member] | Points: 10 | Alert Moderator 

CONVERT(DATE,dtmCreatedDate) = '2012-11-02'
I think it is the best method to get the record in particular date.

>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 7:40:35 PM