Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert date
Message
 
 
To
05/05/2014 11:31:35
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01599545
Message ID:
01599555
Views:
46
>>>We've got a data file that has dates in 'dd-mm-yyyy (time)' format (and coming in as a string) and need them in 'standard amurican' 'mm-dd-yyyy (time)'.
>>>
>>>What's the best way to do this conversion?
>>
>>Are you looking to do the conversion in SSIS or something? How is the file getting loaded?
>>
>>Or is it stored in the table as a string in that format?
>
>Stored as a string

Try
DECLARE @t TABLE (dt VARCHAR(30))

INSERT INTO @t (dt)
VALUES ('30-10-2014')
	,('13-12-2013')

SELECT dt
	,convert(DATE, dt, 105) AS [Real Date]
FROM @t
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform