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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:21:47+00:00 2026-05-30T16:21:47+00:00

Need the solution to solve taking string from the database and replacing the parameter.

  • 0

Need the solution to solve taking string from the database and replacing the parameter.

Here are the sample queries I used to understand more:

--Create Table Table1
--(
--Id int primary key identity(1,1),
--Data varchar(max)
--)

--Create Table Table2
--(
--Id int primary key identity(1,1),
--SampleData varchar(max)
--)

Delete From Table1
GO

Delete From Table2
Go

insert into Table2 (SampleData) values ('How r u ''+@i+''. ')

Declare @i int = 100
Declare @TempSampleData varchar(max) = NULL

While(@i > 0)
begin
    Set @TempSampleData = (select SampleData from Table2)
    insert into Table1 (Data ) values (@TempSampleData)
    insert into Table1 (Data) values ('How r u '+Cast(@i as varchar(500))+'.')
    set @i = @i - 1
End

–Output

Id  Data
103 How r u '+@i+'. --Needed output here is How r u 100.
104 How r u 100.
105 How r u '+@i+'. 
106 How r u 99.
107 How r u '+@i+'. 
108 How r u 98.
109 How r u '+@i+'. 
110 How r u 97.
111 How r u '+@i+'. 
  • 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-30T16:21:49+00:00Added an answer on May 30, 2026 at 4:21 pm

    How about something like this in your loop:

    INSERT INTO Table1 (Data)
    SELECT REPLACE(SampleData, '@i', CAST(@i AS VARCHAR(500)))
    FROM Table2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any solution to solve the problem with this cast example? I need
I need a solution to embed a pdf inside a flash screen i.e. want
I need a solution for caching PHP info on a dynamic page AND include
Simple question: I need a solution so that I can find, lets say names,
I need a quick solution of javascript spell checking. Although all the browsers underlines
Question: I need a DragAndDrop solution to download a file on drop in a
I'm having trouble with Poco libraries. I need a simple solution to make the
I need to code a solution for a certain requirement, and I wanted to
I need to build a solution, but exclude one project. How should I do
I need a cross-platform solution for multi-thread to write to a same file concurrently

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.