SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple Convert function question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BillEdd
Starting Member

8 Posts

Posted - 03/04/2013 :  21:57:33  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 03/04/2013 :  22:44:44  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000