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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:30:27+00:00 2026-05-24T06:30:27+00:00

I have a row that provides me values like shown below: ClubbedValues —————————————————– 561#557,

  • 0

I have a row that provides me values like shown below:

ClubbedValues
-----------------------------------------------------
561#557, 562#558, 563#559, 561#560, 562#560
581#578, 581#579, 581#580
561#557, 562#558, 562#559, 563#560

I have a master table where I have text values against these id’s. For example:

Id     TextValue
-----------------------------------------------------
561    Value1
562    Value2
563    Value3
564    Value4
565    Value5

Now I somehow desire the following output:

ClubbedValues
-----------------------------------------------------
Value1#Value107, Value2#Value108, Value3#Value109 etc..

Where both the text values are mapped somewhere in the master table.

I hope you got the question….

Any help will be appreciated.

Thank you.

  • 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-24T06:30:27+00:00Added an answer on May 24, 2026 at 6:30 am

    You can do this using a table variable and a loop over all values you would need to replace.

    declare @T table(ClubbedValues varchar(max))
    declare @Id int
    declare @Value varchar(10)
    
    -- Get the rows from YourTable that you need to process  
    insert into @T
    select ClubbedValues
    from [your table]
    
    select top 1 
      @Value = TextValue,
      @Id = Id
    from [master table]
    order by Id  
    
    while @@rowcount > 0
    begin
      update @T 
        set ClubbedValues = replace(ClubbedValues, cast(@Id as varchar(10)), @Value)
    
      select top 1 
        @Value = TextValue,
        @Id = Id
      from [master table]
      where Id > @Id
      order by Id  
    end
    
    select *
    from @T
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-row insert that looks something like: insert into table VALUES (1,
I have one multi-row INSERT statement (300 or so sets of values) that I
I would like to have a stored procedure that will update values in a
I have a table row that needs to be hidden when the anchor with
I have a table row that has the error message in it. <tr runat=server
If I have a table of categories with a featured row that is default
I'm working on an iPhone application. I have an object of class Row that
We have a 10 thousand row table that has just 2 columns, a primary
I have a table row, and within that, I have a td (whatever it
I have a method that deletes a row form a database using the sql

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.