I have the following string format and need to return 12345. The length can be 123 or 123456 so I am assuming I need to key off of the "-".
xxx_sssss-aaaa.bb.cc-12345-01
Any ideas?
I am using SQL server and version 8.4.1
Thank you in advance.
Your value has multiple "-" occurrences, so you will need to add on to this, but the gist of what you need involves adding the Position() function to locate the "-" characters. My guess is you will need to keep widdling down the string until you get the desired value.
substring([data Item],position('-',[Data Item]),6)
This is a Cognos 8 generic function, but there may be something in the SQL Server function list (inStr?) that might be more flexible.
HTH.... M
http://www.cognoise.com/community/index.php/topic,14343.0.html (http://www.cognoise.com/community/index.php/topic,14343.0.html)