SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
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  

Starting Member

11 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.



Very Important crosS Applying yaK Herder

52325 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

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.06 seconds. Powered By: Snitz Forums 2000