If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

substring issue

Started by wbarry123, 06 Jun 2011 09:47:53 AM

Previous topic - Next topic

wbarry123

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.

rockytopmark

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