?
Solved

date time in sql

Posted on 2013-01-09
5
Medium Priority
?
301 Views
Last Modified: 2013-01-10
How to convert 11/26/2012 to 112612 ?
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:Crower
ID: 38760011
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '')

this help you?
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 total points
ID: 38760026
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
 
LVL 34

Assisted Solution

by:Paul MacDonald
Paul MacDonald earned 500 total points
ID: 38760036
cast(month([yourdate]) as varchar) + cast(DAY([yourdate]) as varchar) + cast(YEAR([yourdate]) as varchar)
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 500 total points
ID: 38760082
try

select replace(convert(varchar(8), YourDateColumn, 10), '-', '')
0
 
LVL 21

Assisted Solution

by:Alpesh Patel
Alpesh Patel earned 500 total points
ID: 38761788
for SQL Server 2012


SELECT FORMAT(GETDATE(),'MMddyy')
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question