Oracle Date Format And Compare













Oracle dates have a different format than SQL Server dates. So to select a date for the Oracle database you have to have the date in the following format.  
string myDate = "10/9/2012 2:55:25 PM";

string sql = "SELET * FROM SomeTable WHERE SomeDateField=" +
"to_date('" + myDate + "','" + "MM/DD/YYYY HH:MI:SS " +
myDate.Substring(myDate.Length - 2) + "');";

Comments

Popular posts from this blog

Installing AdventureWorks Sample Databases from Microsoft

SQL: GROUP BY And HAVING

ASP.NET : Create an Empty Web Application Project in Visual Studio 2012