Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple Convert function question

Author  Topic 

BillEdd
Starting Member

12 Posts

Posted - 2013-03-04 : 21:57:33
I have a simple select statement like:
Select FN, LN, DateApplied as ApplicationDate from MyTable

I am trying to use the Convert function on ApplicationDate to format it to mm/dd/yyyy so that the output is a little prettier.

How and where do I insert the Convert function in the Select statement? The 101 format string is OK.

Thanks

Bill

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-04 : 22:44:44
you should be trying to do this at front end as applying convert will make date fields come as varchar which can affect results later if you're doing some further manipulations with date like sorting etc

If you really want to do this in t-sql, use

Select FN, LN, convert(varchar(11),DateApplied,101) as ApplicationDate from MyTable


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -