|
Posted by Erland Sommarskog on 06/07/06 21:33
CK (c_kettenbach@hotmail.com) writes:
> Currently the query returns 2006-03-27 00:00:00, can I make it output
> 03/27/2006, I want to truncate the time, and replace the hyphens with
> forward slashes. Any ideas?
To add to David's reply, if you are using Query Analyzer for output,
you can change how dates are formatted under Tools->Options->Connections.
Check "Use Regional Settings...".
You can also do it in an SQL query, look up CASE and CONVERT in Books
Online. But this is a really poor alternative. Date formatting should
be handled by the client, so that the user's regional settings can be
respected.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|