Solved

date time in sql

Posted on 2013-01-09
5
290 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 22

Accepted Solution

by:
Steve Wales earned 125 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 125 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:ewangoya
ewangoya earned 125 total points
ID: 38760082
try

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

Assisted Solution

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


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

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

930 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now