SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert this to date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

joemama
Posting Yak Master

113 Posts

Posted - 04/13/2007 :  18:14:14  Show Profile  Reply with Quote
i have a dynamic sort feature that works fine using CASE...but i need to convert the NVarChar to date time can anyone help me with it?

CASE WHEN @SortBy = '4up' Then Convert( VarChar( 100 ), dbo.Tbl_BaselineAppt.BaseDate ) END ASC

thanks

dinakar
Flowing Fount of Yak Knowledge

USA
2507 Posts

Posted - 04/13/2007 :  18:20:05  Show Profile  Visit dinakar's Homepage  Reply with Quote
what is the error message?


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

joemama
Posting Yak Master

113 Posts

Posted - 04/13/2007 :  18:25:21  Show Profile  Reply with Quote
there is no error message..i just want to know how to convert that statement to datetime

quote:
Originally posted by dinakar

what is the error message?


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 04/13/2007 :  18:34:08  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Convert( VarChar( 100 ), dbo.Tbl_BaselineAppt.BaseDate, 120 )
Convert( DATETIME, dbo.Tbl_BaselineAppt.BaseDate )


Peter Larsson
Helsingborg, Sweden

Edited by - SwePeso on 04/13/2007 18:35:17
Go to Top of Page

joemama
Posting Yak Master

113 Posts

Posted - 04/13/2007 :  18:53:49  Show Profile  Reply with Quote
you rock...thanks

quote:
Originally posted by Peso

Convert( VarChar( 100 ), dbo.Tbl_BaselineAppt.BaseDate, 120 )
Convert( DATETIME, dbo.Tbl_BaselineAppt.BaseDate )


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 04/13/2007 :  19:02:27  Show Profile  Visit SwePeso's Homepage  Reply with Quote
If you are dependent of milliseconds, use 121 instead of 120.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000