Go to DotNetFunda.com
 Online : 58 |  Welcome, Guest!   Login
 Skip Navigation Links Home > Forums > Sql Server > how to convert string of date-time to datetime format
Notice: If page content has been copied from other sources without proper permission, kindly let us know with details from where it has been copied for further action.

Sql Server Forum


how to convert string of date-time to datetime format

Author: Abhi_patil | Posted on: 7/10/2009 | Category: Sql Server | Views: 2115 |  Print |
i have table report contains colume report_date having datatype nvarchar..

but now i want to get report before specific date..so how i can get that report correctly..

ex. i want to get report <'7/8/2009 10:10:50 AM'
how i can write query for that...

thanks..

Reply



Interesting?   Share and Bookmark this


 Responses
Bravi  
Posted on: 7/13/2009 1:26:18 AM
Reply

I hope this code will useful for you try this

Convert(datetime,report_date)<Convert(datetime,'7/8/2009 10:10:50 AM' )

After writing query in where conditon write like this so you can get records..


PandianS  
Posted on: 7/13/2009 1:51:28 AM
Reply

select Col1,Col2 from report where CAST(Report_Date AS DATETIME) < '7/8/2009 10:10:50 AM'

Regards


Latest Questions


 Ask a Question


Advertisement


About Us | The Team | Contact Us | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)