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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:56:42+00:00 2026-05-25T05:56:42+00:00

I have a column that gives info on how to parse another column within

  • 0

I have a column that gives info on how to parse another column within the same table.The column has the property name and string length of the value that it appears in the next column. Here is how it looks:

PropertyNames   PropertyValuesString
SP_PartnerCode:S:0:14:FirstName:S:14:5:LastName:S:19:9: InvestProBase2rogerpatterson
SP_PartnerCode:S:0:14:FirstName:S:14:5:LastName:S:19:7: InvestProBase2AaronSchmidt
SP_PartnerCode:S:0:0:FirstName:S:0:6:LastName:S:6:9:    JosephGaultieri
SP_PartnerCode:S:0:14:FirstName:S:14:4:LastName:S:18:9: InvestProBase2ToddEdmondson
SP_PartnerCode:S:0:14:FirstName:S:14:7:LastName:S:21:4: InvestProBase2MichaelLove

I want to separate this into a column per property name, like this:

SP_PartnerCode  FirstName   LastName
InvestProBase2  roger   patterson
InvestProBase2  Aaron   Schmidt
    Joseph  Gaultieri
InvestProBase1  Kevin   Lemmon
InvestProBase1  John    Switzer
InvestProBase2  bryan   abbott
InvestProBase2  Todd    Edmondson
InvestProBase2  Michael Love

Is this possible?

  • 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-05-25T05:56:42+00:00Added an answer on May 25, 2026 at 5:56 am

    You should really normalize your data, was the first thing that came to my mind.

    This function parses your data for a given property:

    create function Parse(@property nvarchar(4000), 
        @meta nvarchar(4000), @data nvarchar(4000))
    returns nvarchar(4000)
    as
    begin
        set @meta = N':' + @meta
    
        declare @iproperty int, @itype int, @ibegin int, @ilength int, @iend int
        set @iproperty = charindex(N':' + @property + N':', @meta)
        if @iproperty = 0 return null
    
        set @itype = charindex(N':', @meta, @iproperty + 1)
        set @ibegin = charindex(N':', @meta, @itype + 1)
        set @ilength = charindex(N':', @meta, @ibegin + 1)
        set @iend = charindex(N':', @meta, @ilength + 1)
    
        declare @sbegin nvarchar(5), @slength nvarchar(5)
        set @sbegin = substring(@meta, @ibegin + 1, @ilength - @ibegin - 1)
        set @slength = substring(@meta, @ilength + 1, @iend - @ilength - 1)
    
        declare @begin int, @length int
        set @begin = convert(int, @sbegin)
        set @length = convert(int, @slength)
    
        if @length = 0 return null
    
        return substring(@data, @begin + 1, @length)
    end
    

    and then SELECT your data

    select 
    dbo.Parse('SP_PartnerCode', PropertyNames, PropertyValuesString) as SP_PartnerCode,
    dbo.Parse('FirstName', PropertyNames, PropertyValuesString) as FirstName,
    dbo.Parse('LastName', PropertyNames, PropertyValuesString) as LastName
    from MyTable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a select from table which does not have column that tells when
I have a column that has fields such as C5, C6, C3, CC, CA,
I have a column that has the following data: PersonId=315618 LetterId=43 MailingGroupId=1 EntityId=551723 trackedObjectId=9538
I have a table column that needs to be limited to a certain width
I have a varchar column that has data like this top<somenumber> so the word
I have column that contains strings. The strings in that column look like this:
I have a column that contains links. The problem is that the titles of
I have a column that I need to be able to guarantee never gets
I have a text column that should only have 1 of 3 possible strings.
I have a database column that contains the contents of a file. I'm converting

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.