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 8639469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:01:02+00:00 2026-06-12T11:01:02+00:00

I currently have a SQL query that is displaying several columns of data. In

  • 0

I currently have a SQL query that is displaying several columns of data. In one of those columns I would like to pare down the data to only display what is really needed. The problem is the data I want is in the middle of string. I know what is before the value I need and what is after that is a fixed constant. The rest of the string may change. Is there a way in a SQL query to only display that data?

Below is an example of the data in the string. I would like to only see the data between the LR and SCCM.

A   %VR1  P  P%V 104.922043 %      Pt 4.902552 psig       PLR2  P  LR **0.350922** sccm      PL 0.001313 dpsig   

R   %VR1  P  P%V 105.017807 %      Pt 4.934245 psig       PLR2  F  LR **5.366095** sccm      PL 0.014557 dpsig     

A   %VR1  P  P%V 100.644852 %      Pt 5.112900 psig       PLR2  P  LR **-0.029057** sccm     PL 0.000377 dpsig     

A   %VR1  P  P%V 101.631256 %      Pt 5.107606 psig       PLR2  P  LR **2.515130** sccm      PL 0.006896 dpsig       
  • 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-12T11:01:03+00:00Added an answer on June 12, 2026 at 11:01 am

    MySQL Version:

    SET @var = 'A %VR1 P P%V 104.922043 % Pt 4.902552 psig PLR2 P LR 0.350922 sccm PL 0.001313 dpsig';
    
    SELECT SUBSTRING(@var, LOCATE('LR ', @var) + 3, LOCATE('sccm', @var) - LOCATE('LR ', @var) - 3)
    

    Result

    0.350922

    SQL Server Version:

    DECLARE @var varchar(200)
    SET @var = 'A %VR1 P P%V 104.922043 % Pt 4.902552 psig PLR2 P LR 0.350922 sccm PL 0.001313 dpsig'
    
    SELECT SUBSTRING(@var, CHARINDEX('LR ', @var) + 3, CHARINDEX('sccm', @var) - CHARINDEX('LR ', @var) - 3)
    

    Result

    0.350922

    With a column name:

    SELECT SUBSTRING(col1, CHARINDEX('LR ', col1) + 3, CHARINDEX('sccm', col1) - CHARINDEX('LR ', col1) - 3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a SQL query that returns a number of fields. I need
I currently have the following SQL query that lists all the names of all
I currently have a filesystem path I would like to index into a SQL
I have a SQL query that I'm currently solving by doing two queries. I
I currently have an SQL query which is currently called multiple times like this
I have a query that joins many columns. I think it currently is fast
I currently have a SQL query that returns results based on a dynamic number
I currently have this sql statement that I wrote and it works but it's
I currently have two SQL commands. One retrieves a list of unique IDs from
I have an sql statement that currently is just returning all the end parent

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.