• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

date time in sql

How to convert 11/26/2012 to 112612 ?
0
VBdotnet2005
Asked:
VBdotnet2005
4 Solutions
 
MarianoTeam LeaderCommented:
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '')

this help you?
0
 
Steve WalesSenior Database AdministratorCommented:
Expanding on Crower's offering.

If the date you've got is a text column somewhere, rather than already a datetime:

SELECT REPLACE(CONVERT(VARCHAR(10), convert(datetime, '11/26/12', 1), 1), '/', '')

(Or replace the literal of the date with the column name)
0
 
Paul MacDonaldDirector, Information SystemsCommented:
cast(month([yourdate]) as varchar) + cast(DAY([yourdate]) as varchar) + cast(YEAR([yourdate]) as varchar)
0
 
Ephraim WangoyaCommented:
try

select replace(convert(varchar(8), YourDateColumn, 10), '-', '')
0
 
Alpesh PatelAssistant ConsultantCommented:
for SQL Server 2012


SELECT FORMAT(GETDATE(),'MMddyy')
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.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now