September 15, 2009 at 11:05 am
Hi
I have a column with values stored as like for eg: 12345-00-0001-01-123.
How can i get the string by eleminating the substring between the 3rd and 4th occurance of '-' in the string. for eg: 12345-00-0001-123
(the length of the string may vary. I need to go by the '-')
Any help appreciated.
Thanks
Gan
September 15, 2009 at 11:16 am
This will for sure get you on track : http://www.sqlservercentral.com/scripts/31797/
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
September 15, 2009 at 3:51 pm
If you have the option to use the CLR for that, then do.
string[] parts = String.Split(input, new char[] { '-' });
return (parts.Length > 3) ? parts[3] : string.Empty;
Atlantis Interactive - SQL Server Tools
My blog[/url]
Why I wrote a sql query analyzer clone
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply