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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Suthish NairRank #92 · 22.8K reputationPosted Jan 31, 2011, 9:40 PM EST
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"Suthish NairRank #92 · 22.8K reputationPosted Jan 31, 2011, 8:42 PM EST
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)Vijay YadavRank #1,637 · 943 reputationPosted Jan 31, 2011, 8:47 PM EST
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
Vijay YadavRank #1,637 · 943 reputationPosted Jan 31, 2011, 9:48 PM EST
Thanks for your reply.
Regards,
Vijay
Vijay YadavRank #1,637 · 943 reputationPosted Jan 31, 2011, 10:08 PM EST
The solution of my query is:
select (convert(Varchar(50),LogInTime,101)+' '+convert(Varchar(50), LogInTime,108)) "LogInTime" from tbl_Log
Regards,
Vijay