Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string manipulation to convert to a date

Status
Not open for further replies.

murphyhg

Technical User
Mar 1, 2006
98
US
I have some data that I need to convert over to proper date time format. Right now the data looks like this.
2008, July 14-18
2000, October 24 - November 4

I have about 800 rows other than doing this by hand how can I use T-SQL to accomplish this? Thanks for helping.
 
To me, the string "2008, July 14-18" represents multiple dates. So it can't really be converted into a date. Do you want to break it out into five separate dates? You also need to define other business rules. "2000, October 24 - November 4" to me means October 24-November 4, 2008. Well, what if the range spans multiple years? How will that be represented?

I'm afraid that the strings look like free-form text. If that's the case, and there were no rules to enforce how the data is entered, you're going to spend more time writing CASE statements and special logic to parse the dates than to manually convert 800.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top