Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert this to date

Author  Topic 

joemama
Posting Yak Master

113 Posts

Posted - 2007-04-13 : 18:14:14
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
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-13 : 18:20:05
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 - 2007-04-13 : 18:25:21
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

30421 Posts

Posted - 2007-04-13 : 18:34:08
Convert( VarChar( 100 ), dbo.Tbl_BaselineAppt.BaseDate, 120 )
Convert( DATETIME, dbo.Tbl_BaselineAppt.BaseDate )


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

joemama
Posting Yak Master

113 Posts

Posted - 2007-04-13 : 18:53:49
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

30421 Posts

Posted - 2007-04-13 : 19:02:27
If you are dependent of milliseconds, use 121 instead of 120.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -