I am using SQL Server 2008. How can I change the date to 04/14/10? Thanks.
SELECT CONVERT(VARCHAR(255), [TTRHours], 109) FROM [GM].[dbo].[WORKING_SVR_CLOSED] WHERE TTRHours <> '-' Results: (No column name) Apr 14 2010 Apr 14 2010
All you should have to do is change the last parameter (style) in the CONVERT call. You are currently using 109 which gives you a format of ‘mon dd yyyy’. If you simply change the style parameter to 101 instead, you’ll get the format of mm/dd/yyyy. If you change the style to 1, you’ll get mm/dd/yy.
Check out the full list of styles and the full usage description of the CONVERT function.
Have a question for Karen Morton? Send an e-mail to email@example.com
Dig deeper on Oracle and SQL
Related Q&A from Karen Morton
Learn how to do simple SQL arithmetic operations without using the arithmetic operators.continue reading
One reader asks if it is the best practice to store a document inside an Oracle database.continue reading
One reader asks how to create and retrieve a binary large object (BLOB), and SQL expert Karen Morton gives some comprehensive advice and tips.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.