Date conversion from mm/dd/yyyy to yyyymmdd in sqlserver 2005

Hi!
I need convert date in the format mm/dd/yyyy to yyyymmdd
and also mm/dd/yy  to yyyymmdd format.I'm not able to find an appropriate solution for that.
Also how do I convert time in the format hh:mm:ss.xxx(xxx represent milli seconds)
to hh:mm:ss:xxxx .
How do I convert time in the format hhmmssx to hh:mm:ss:xxx?
How do I convert time in the format hh:mm:ss.xxx to hh:mm:ss?
How do I convert time in the format hh:mm:ss to hhmmss?
All of these in sql server 2005.
can I get the code if possible?
Please let me know ASAP.

Thanks in advance


amuktaAsked:
Who is Participating?
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.

Doc_McAlisterCommented:
You actually want to change what they are **stored as** or how they are formatted when you select them?
0
Anthony PerkinsCommented:
Datetime and smalldatetime are not stored in any regional format.  In order to convert for display purposes to some typical formats, take a look at the CONVERT() function in BOL
0
ursangelCommented:
Use the Convert function in SQL to convert the date format according to your choice.
You can specify the <Style> tag according to your choice.
For eg:- convert (datetime, <Column Name>, 112 ) will give you the format yyyymmdd
Like wise you can get different formats.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

amuktaAuthor Commented:
Hi! Doc McAlister,

I want to change the formatwhile selecting them.
Thanks,
Amukta
0
amuktaAuthor Commented:
Hi! ursangel,

Unable to do it with the solutio u've sent me, for soem reason.
Is there any other alternative.

Thanks,
0
Anthony PerkinsCommented:
>>Unable to do it with the solutio u've sent me, for soem reason.<<
Try posting your query and we can be more specific.

>>Is there any other alternative.<<
There is no other alternative with T-SQL.
0
Doc_McAlisterCommented:
More information is here:

http://technet.microsoft.com/en-us/library/aa226054(SQL.80).aspx

Select convert(datetime, columnName, 112) From tableName
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
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

From novice to tech pro — start learning today.