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

  • Home
  • SEARCH
  • 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 4580084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:44:00+00:00 2026-05-21T20:44:00+00:00

Forgive me as I’m relatively new to SQL. But I’m trying to take modified

  • 0

Forgive me as I’m relatively new to SQL. But I’m trying to take modified data from a SELECT query on one table, and use it to populate data into another table.

SELECT ID FROM TABLE WHERE VALUE=10

I want to insert the resultant ID’s into another Table, but with modifications such that the value is:

1stString.ID.2ndString

I’ve found answers for how to use the ID from the SELECT in the insert, but I can’t seem to get it working when trying to concatenate. There are also other values that I’m inserting, but they’re literals (I’m trying to initialize default key settings for the ID’s given in another table.

Using MS SQL Studio 2008, btw.

  • 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-21T20:44:01+00:00Added an answer on May 21, 2026 at 8:44 pm
    INSERT INTO table (field)
    SELECT '1stString.' + cast(id as varchar(50)) + '.2ndString' 
    FROM table2 
    WHERE id = 10
    

    Edit – response to comment:
    You’re on the right track, but you want to select your hard-coded strings from your table, like this:

    INSERT INTO table1 (field1, field2, field3)
    SELECT '1stVal', '2ndVal', '1stString.' + cast(id as varchar(50)) + '.2ndString' 
    FROM table2 
    WHERE id = 10
    

    This is also illustrated in Dustin Laine’s answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Forgive me my C++ is incredibly rusty. But I am trying to take some
Forgive me, for I am fairly new to C++, but I am having some
Forgive my elementary question as I'm pretty new to cocos2d, but I'm having an
Forgive me for a potentially silly question here, but in other programming languages (scripting
You'll have to forgive my ignorance, but I'm not used to using wide character
I'm trying to learn C++ so forgive me if this question demonstrates a lack
Forgive me if this is a slight mis-use of the system, but I'd like
Forgive me if I'm being obtuse, but I'm a little bit confused by the
Forgive me for asking such a simple question, I'm new to both HTML and
Forgive me if the title is not lucid, but I could not better describe

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.