troubleshooting Question

TRIM and convert to DATE

Avatar of misermice
misermice asked on
Microsoft SQL Server 2005Microsoft SQL Server 2008
21 Comments1 Solution451 ViewsLast Modified:
I have a 10000 rows in a filed of Type varchar(30)

Smaple sat looks like this

ERC2009Q1
LRC2009Q4
SRC2009Q3
TRC2009Q2
ERC2009Q1
ERC2009Q1

I need it to be converted to date.
Where right most charecter represents months
1----->   3
2----->   6
3------>  9
4------->12

and 4 to 7th charecters represent year

and defaulting day to 1 in every case

so the o/p would look like

ERC2009Q1-------------------->03/01/2009
LRC2009Q4-------------------->12/01/2009
SRC2009Q3-------------------->09/01/2009
TRC2009Q2-------------------->06/01/2009
ERC2009Q1-------------------->03/01/2009
ERC2009Q1-------------------->03/01/2009


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 21 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros