data types in sql server



Hi,
       I have a query in sql server that returns the following
The table these data fields come from is a local temp table
The data itself comes from an OPENQUERY to an Oracle database

My question is,
I would like the date time to be presented as for example
Jan 14 2011 14.00
not as
Jan 14 2011 2:00PM

Is there some data type i can declare in the temp table that will produce this format?

Thanks
 datatypes
blossomparkAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
I will answer with an article about date/time:
http://www.experts-exchange.com/A_1499.html

in short: your "output" is a presentation issue, not a data type issue per set.
the data is datetime. you want the output to be a certain format, so you need to format it to a string at some point.
you can do this in the database. in Oracle, it would be TO_CHAR, in SQL Server, it's CONVERT with the proper styles if available, otherwise it get's a bit "dirty" ...
0
 
Imran Javed ZiaConnect With a Mentor Consultant Software Engineer - .NET ArchitectCommented:
Hi,
You can use following:
select convert(varchar, getdate(), 113)
select convert(varchar, getdate(), 13)
Please refer to following for more details
http://sql.dzone.com/news/custom-date-formatting-sql-ser
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx
Thanks
0
 
blossomparkAuthor Commented:
Hi angelIII and IJZ, that gives me plenty to work with...thanks for your responses...much appreciated :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.