Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Parsing dynamic range values from a string.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-24 : 07:58:29
Paul writes "Hi,

What would be the best way to parse out a dynamic min and max range from a string. For example, a min and max range exist in all of the string examples below. The string could be in any of the formats below, and the values of course will not always be 2500 and 3000.

Examples
1. "2500-3000"
2. "2500 - 3000"
3. "2500 - 3000 sq ft"
4. "Square Footage: 2500-3000"

I need to load the min and max values into their own variables without any text.

Thanks in advance for your help."

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-24 : 09:45:23
tough req...

if your limited to that set, it's easier, but I have a feeling this free form thing will allow stuff to fall out...

why is it coming in that way.

Can't controls be placed up front to give you exactly what you want.

If you always get a dash (doubtful) then use CHARINDEX to locate the position and start playing with SUBSTRING..

GOOD LUCK


(but I would modify the front end or the data collection method)



Brett

8-)
Go to Top of Page
   

- Advertisement -