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
 format in 2010
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

seeker62
Starting Member

40 Posts

Posted - 01/18/2013 :  12:55:20  Show Profile  Reply with Quote
This
FORMAT(CONVERT(VARCHAR(8),CAST(@end_value AS DATE),112), 'MM/DD/YYYY')

gives me an error saying that FORMAT is not recognized so how do I format a date string into mm/dd/yyyy

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2004 Posts

Posted - 01/18/2013 :  13:05:20  Show Profile  Visit jackv's Homepage  Reply with Quote
using the 101 option and CONVERT you can get the format you require. Read more in books online

SELECT CONVERT(nvarchar(10), GETDATE(), 101) AS Convert_to_101 ;

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/18/2013 :  13:12:13  Show Profile  Reply with Quote
FORMAT() function is only available from 2012 onwards

Ideally you should be trying to do formatting at front end if possible. Converting dates to varchar just for formatting is an overkill

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

Go to Top of Page

seeker62
Starting Member

40 Posts

Posted - 01/18/2013 :  15:54:53  Show Profile  Reply with Quote
Thanks your input created a fix.
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.05 seconds. Powered By: Snitz Forums 2000