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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Imran Javed ZiaConsultant 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.