Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

date time in sql

Posted on 2013-01-09
5
Medium Priority
?
305 Views
Last Modified: 2013-01-10
How to convert 11/26/2012 to 112612 ?
0
Comment
Question by:VBdotnet2005
5 Comments
 
LVL 3

Expert Comment

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

this help you?
0
 
LVL 23

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 35

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

569 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