Hi,
In orcale, we have To_Date built-in function. I want to know whether we can use somthing similar function in SQl 2008.
Any help would be appreciated.
Thanks,
Vijay
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Feb 1, 2011, 2:40 AM
select (select convert(varchar, CAST('2011/02/01 1:00:00 PM' AS DATETIME), 101)) + ' ' +(select convert(varchar, CAST('2011/02/01 1:00:00 PM' AS DATETIME), 114)) "datetime"Vijay YadavPosted Feb 1, 2011, 3:08 AM
The solution of my query is:
select (convert(Varchar(50),LogInTime,101)+' '+convert(Varchar(50), LogInTime,108)) "LogInTime" from tbl_Log
Regards,
Vijay
Vijay YadavPosted Feb 1, 2011, 2:48 AM
Thanks for your reply.
Regards,
Vijay
Vijay YadavPosted Feb 1, 2011, 1:47 AM
Thanks for your reply, i not migrating from oracle to sql actly sql server 2008 save the datetime in yyyy/MM/dd hh:mm:ss and i want to display in MM/dd/yyyy hh:mm:ss format and the foramt which are like 101 t0 131 they doesn't contain this format.
Do you have any idea.
Regards,
vijay
Suthish NairPosted Feb 1, 2011, 1:42 AM
you can use sysdb.ssma_oracle.to_date2, sysdb.ssma_oracle_to_char_date functions.
Else,
select CAST('1/28/2008 1:00:00 PM' AS DATETIME)select convert(varchar, GETDATE(), 101)