Q:

TSQL Date conversion Trouble

I have data in a table I am getting from a 3rd party. The date in the column is in a format I havent seen before.
Here is an example of the date: 2013MO01 This date is Jan, 2013 with MO meaning Month 1
Any easy suggestions on getting the date from that field in the database ?

A:

As @chrono mentioned, you can use SUBSTRING, for example:
DECLARE @t NVARCHAR(100) = '2013MO01'
SELECT CAST(SUBSTRING(@t, 1, 4) + '-' + SUBSTRING(@t, 7, 2) + '-01' AS DATETIME)

Or just replacing the MO string:
SELECT CAST(REPLACE(@t, 'MO', '-') + '-01' AS DATETIME)

