Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:58:56+00:00 2026-06-02T19:58:56+00:00

I have some odd data in a vendor database but need to be able

  • 0

I have some odd data in a vendor database but need to be able to extract multiple different parameters from one field in the db.

So from this example i would like to pull out all items that fall between (” % “)

Between quotes is a string, disregard that it looks like code:

“Func_GetParameterLatestValue(“IBW Patient Height RT Assess”) kHeight =Func_GetParameterLatestValue(“Height For IBW Vent Misc”) If (kSex) = “” Then
Return_Value =NULL Else If kHeight > 0 Then If kSex=1 Then Return_Value= Round(((kHeight – 152.4)*.91)+50,0) Else
Return_Value= Round(((kHeight – 152.4)*.91)+45.5,0) End IF Else Return_Value = NULL End IF End IF ‘ Return_Value = kHeight ‘(“IBW Patient Height RT Assess”)”

so the return values would be:

IBW Patient Height RT Assess,
Height For IBW Vent Misc,
IBW Patient Height RT Assess

Im open to any suggestions to try and make this work. Ideally i would like to be able to slam the results in a subquery as well to make sure that they exist on another table.

This query currently returns the first instance

select vbs.Name, 
        SUBSTRING(sd.FormulaDetails, 
                  CHARINDEX('("', sd.FormulaDetails)+2,(CHARINDEX('")',sd.FormulaDetails) - CHARINDEX('("', sd.FormulaDetails))-2)
from StatementDefinitions sd, MvVBScript vbs
where sd.ScriptID = vbs.ID
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:58:57+00:00Added an answer on June 2, 2026 at 7:58 pm

    You can do this recursively with a WITH statement. Here’s a shot at it. Change varchar(max) to whatever the data type of your FormulaDetails column is. In case you want it, this query returns the ScriptID and numbers the position of the chunk it finds (so ‘Height For IBW Vent Misc’ would be occurrence 2)

    with Chunks(id,occurrence,position,token,remainder) as (
      select
        ScriptID,
        cast(0 as int),
        charindex(@token,FormulaDetails),
        cast('' as varchar(max)),
        substring(c,charindex(@token,FormulaDetails)+1,len(FormulaDetails))
      from StatementDefinitions
      where FormulaDetails like '%'+@token+'%'
      union all
      select
        id,
        occurrence+1,
        charindex(@token,remainder)+position,
        cast(substring(remainder,1,charindex(@token,remainder)-1) as varchar(max)),
        substring(remainder,charindex(@token,remainder)+1,len(remainder))
      from Chunks
      where remainder like '%'+@token+'%'
    )
      select id, occurrence, token from Chunks
      where occurrence > 0
      order by id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an odd one - I am porting some data from one CMS
Ok, I have some rather odd behavior in one of my Projects and I'm
Ok, so I have some problems with C++ iostreams that feels very odd, but
I have some data coming from other tiers and it represents an EF object.
We have some XAML which may seem odd but apparently is needed for defining
I have some data coming from the hardware. Data comes in blocks of 32
I have some output data from some Bash Shell commands. The output is delimited
I have some UIViews that have different centers and transforms applied to them. I
I have some images with height=auto because sometimes they are different heights whereas they
I have some data for my sites statistics in a SQL DB: date: visits:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.