Home Forums SQL Server 2012 SQL 2012 - General converting an date from oracle to a regular datetime in sql RE: converting an date from oracle to a regular datetime in sql

  • DECLARE @oracledate varchar(50) = '25-JUN-13 12.01.15.096000000 AM'

    select try_convert(datetime2, substring(@oracledate, 1, 12) + ':' +

    substring(@oracledate, 14, 2) + ':' +

    substring(@oracledate, 17, 50))

    But this will hot work of if there is not leading zeores for all one-digit number.

    And one could ask why Oracle produces this value in the first place. Surely Oracle has other options?

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]