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

  • SEARCH
  • Home
  • 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 7833051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:32:52+00:00 2026-06-02T12:32:52+00:00

Here is the string :'(a+b)+(x/y)*1000′ from that string i want to get ‘(x/y)’ meaning

  • 0

Here is the string :'(a+b)+(x/y)*1000′
from that string i want to get ‘(x/y)’ meaning i want the part that contains the division to check later if denominator <> 0 to avoid division by zero.

The string formula can vary but divisions are always between parenthesis.

How can i achieve that in sql ?

  • 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-02T12:32:53+00:00Added an answer on June 2, 2026 at 12:32 pm

    Bits that it appears you already have (based on a comment you made)…

    • Pos of the '/' = CHARINDEX('/', yourString)
    • Pos of the ')' = CHARINDEX(')', yourString, CHARINDEX('/', yourString) + 1)

    The position of the ( is a little different, as you need to search backwards. So you need to reverse the string. And so you also need to change the starting position.

    • CHARINDEX('(', REVERSE(yourString), LEN(yourString) - CHARINDEX('/', yourString) + 2)

    Which give the position from the right hand side. LEN(yourString) - position + 1 give the position from the left hand side.

    Add that all together and you get a very long formula…

    SUBSTRING(
      yourString,
        LEN(yourString)
      - CHARINDEX('(', REVERSE(yourString), LEN(yourString) - CHARINDEX('/', yourString) + 2)
      + 1,
        CHARINDEX(')', yourString, CHARINDEX('/', yourString) + 1)
      - LEN(yourString)
      + CHARINDEX('(', REVERSE(yourString), LEN(yourString) - CHARINDEX('/', yourString) + 2)
      - 1
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: when I say static string here I mean memory that can not be
Here is my string $newPath = '/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js'; Now check this output var_dump($newPath); // string(64)
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
sTypeName = ... //do some string stuff here to get the name of the
Here is the code that generates .xls file using JXL: public void generateXls(String fileName,
I am using datatable to retrieve 1000 records from mysql database. I want to
i want to save xml data into a table in sp,passed as string,here is
EDIT: Here is a portion of $preparedstring : 555555,Jones,Brian,NYC,1000,2011-10-21 00:00:00,Check,1542,0, ,Check, ,0, ,Check, ,;
Here is the setup: I have a class called Sprite that contains an image
So here is my goal, I want to get how long ago a certain

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.