Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > Database

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-06-2009, 12:52 PM
rkbnair rkbnair is offline
Registered User
 
Join Date: Jun 2004
Posts: 276
SQL Server 2008, how to set date format

In SQL Server 2008 Management Studio, how can we set the date display format to mm/dd/yyyy? Is to be done every session? Or, is it something that to be set at the database level?

Thanks.
Reply With Quote
  #2  
Old 10-07-2009, 08:34 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Does this help?
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 10-07-2009, 10:07 AM
rkbnair rkbnair is offline
Registered User
 
Join Date: Jun 2004
Posts: 276
It should default to a format

No, it doesn't help. There is no need to all these formatting. When you open the contents of the table, the date fields should default to a format.
Reply With Quote
  #4  
Old 10-07-2009, 05:16 PM
Emefa Emefa is offline
Registered User
 
Join Date: Jul 2007
Location: Minnesota
Posts: 148
rkbnair

SQL Server is different from Microsoft Access.
It does not have the fancy look of showing date out of the box in a format like Access does.
When you run a query, you then determine at that point what format you want the date to be.
Other things you could do is to do the following:

Set the database collation to Latin1_General_CI_AS and probably set the language to US English.
http://msdn.microsoft.com/en-us/library/ms187928.aspx

The link provided above will help you format date when running a query.

If you open a query window, you can run this:
Code:
SELECT convert(char(10),getdate(),101)
That should return the date in mm/dd/yyyy for you.
If you wish to run the query against tableA with date column being MyDate,
you will use
Code:
SELECT 
          convert(char(10),MyDate,101) 
FROM
          tableA
Does this help?
Emefa
Reply With Quote
  #5  
Old 10-07-2009, 05:34 PM
rkbnair rkbnair is offline
Registered User
 
Join Date: Jun 2004
Posts: 276
Agree. But it shouldn't be much different from SQL 2005, right ?

Why it is defaulted in SQL 2005 and not available in 2008?
Reply With Quote
  #6  
Old 10-07-2009, 05:43 PM
Emefa Emefa is offline
Registered User
 
Join Date: Jul 2007
Location: Minnesota
Posts: 148
Good question.
Sure enough, I fired up my 2008 and 2005 side by side and you are very right.
I wonder why they changed it.
I know the concept of Date and Datetime2(7) got added.
That probably explains why the difference is the way it is.
Don't you just love it when things like this change from version to version?
I bet someone will write an article about this if it is not already out there somewhere.

Emefa
Reply With Quote
  #7  
Old 10-07-2009, 05:53 PM
rkbnair rkbnair is offline
Registered User
 
Join Date: Jun 2004
Posts: 276
yeah, you are absolutely right. Should have written an article
Reply With Quote
  #8  
Old 10-08-2009, 08:25 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
This is as close to an article on the subject as I could find.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #9  
Old 10-28-2009, 10:27 PM
unenforcibility's Avatar
unenforcibility unenforcibility is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
I don't have sql server 2008 yet but thanks, I'll keep in mind
Reply With Quote
  #10  
Old 11-03-2009, 06:18 AM
pinswitiz pinswitiz is offline
Registered User
 
Join Date: Nov 2009
Posts: 2
use AQL 2008 that's good
Reply With Quote
  #11  
Old 11-03-2009, 08:56 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
What is AQL?
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2008 -- Trouble adding Foreign Key lagyossarian Database 2 09-18-2009 03:17 PM
find version & service packs rperez Database 5 01-02-2009 05:14 PM
SQL DMO Restores in VB? ObiWan VB Classic 3 05-23-2006 11:35 AM
How can i change set the date format in sql2000 to dd/mm/yyyy???? Guillermo Database 2 06-29-2001 12:16 PM
How to set up a Current date field in SQL server Tiffany Sanches VB Classic 2 01-19-2001 08:24 PM


All times are GMT -4. The time now is 08:09 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.