Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date time in sql

Posted on 2013-01-09
5
Medium Priority
?
303 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 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

618 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