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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:39:56+00:00 2026-06-11T21:39:56+00:00

I need to check the existence of following characters in a given string: characters

  • 0

I need to check the existence of following characters in a given string:

characters =('N', 'E', 'M', 'H', 'T', 'V', 'L', 'C' )
string = 2449.555N06704.2855EM0701H071T44.098V11.764L0.372C1

And if string contains these characters, then need to split them into values as following to insert them in details_Tb:

N = 2449.7183 
E = 06704.2855 
T = 0701
H = 071
T = 44.098
V = 11.764
L = 0.372
C =  1

Any solution to this?

  • 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-11T21:39:57+00:00Added an answer on June 11, 2026 at 9:39 pm

    If you are looking for this result

    result:

    N=2449.555
    E=06704.2855
    H=0701
    T=071
    V=44.098
    L=11.764
    C=0.372
    

    then try this query..

    DECLARE @CHARACTERS TABLE (CHARS CHAR(1)) 
    INSERT INTO @CHARACTERS VALUES
    ('N'), ('E'), ('M'), ('H'), ('T'), ('V'), ('L'), ('C' );
    DECLARE @STRING VARCHAR(500);
    SET @STRING= '2449.555N06704.2855EM0701H071T44.098V11.764L0.372C1';
    
    WITH CTE AS (
    SELECT      CHARS+'='+CAST(REVERSE(LEFT(REVERSE(LEFT(@STRING,
                CHARINDEX(CHARS,@STRING,1)-1)), PATINDEX('%[^0-9,.]%',
                REVERSE(LEFT(@STRING,CHARINDEX(CHARS,@STRING,1)-1)) + 'Z')-1))
                AS VARCHAR(50)) AS RESULT
    FROM        @CHARACTERS )
    SELECT * FROM CTE WHERE LEN(RESULT)>2
    

    EDIT1 : As per the comment, if you want to insert the these values to detail_Tb table, please check the code below:

    create table detail_Tb(N float,E float,M float,
                H float,T float,V float,L float,C float);
    
    DECLARE @CHARACTERS TABLE (CHARS CHAR(1)) 
    INSERT INTO @CHARACTERS VALUES
    ('N'), ('E'), ('M'), ('H'), ('T'), ('V'), ('L'), ('C' );
    DECLARE @STRING VARCHAR(500);
    SET @STRING= '2449.555N06704.2855EM0701H071T44.098V11.764L0.372C1';
    DECLARE @cols AS NVARCHAR(MAX),
        @query  AS NVARCHAR(MAX)
    
    ;WITH CTE AS (
    SELECT      CHARS,CAST(REVERSE(LEFT(REVERSE(LEFT(@STRING,
                CHARINDEX(CHARS,@STRING,1)-1)), PATINDEX('%[^0-9,.]%',
                REVERSE(LEFT(@STRING,CHARINDEX(CHARS,@STRING,1)-1)) + 'Z')-1))
                AS VARCHAR(50)) AS RESULT
    FROM        @CHARACTERS )
    SELECT * into #tmp FROM CTE WHERE len(RESULT)>2  
    
    
    select @cols = STUFF((SELECT distinct ',' + QUOTENAME(CHARS) 
                        from #tmp
                FOR XML PATH(''), TYPE
                ).value('.', 'NVARCHAR(MAX)') 
            ,1,1,'')
    
    set @query = 'Insert into detail_Tb('+@cols+') 
                  SELECT ' + @cols + ' from #tmp x
                pivot 
                (
                    MAX([RESULT])
                    for CHARS in (' + @cols + ')
                ) p '
    execute(@query)     
    Drop table #tmp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to check the existence of an input argument. I have the following
I need to check for the existence of a file in a directory. The
We need to check for the existence of a SQL server across all domains
I need to check for the existence of a YMD uri date param on
For form validation to check email existence I need custom validation I tried money
Is this a possible function? I need to check if a variable is existent
I need to check for a condition on each page I visit on the
I need to check for duplicates before saving to the database in the create
I need to check some settings for all users on Windows clients in the
I need to check if a link (a-tag) is the only content (not just

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.