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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:14:30+00:00 2026-06-18T00:14:30+00:00

How would I copy a bunch of rows into a table and then change

  • 0

How would I copy a bunch of rows into a table and then change the values in one column and insert them back into the same table?

The table has these columns:

[PositionControlPositionId]
  ,[PositionControlPositionJobId]
  ,[PositionControlPositionRefLocationId]
  ,[PositionControlPositionCount]
  ,[PositionControlPositionEmploymentType]
  ,[PositionControlPositionLabel]

PositionControlPositionID is the primary Key
PositionControlPositionRefLocationId and PositionControlPositionCount are foreign keys

I have tried the below query but it didn’t work

Insert into [dbo].[PositionControlPosition] ([PositionControlPositionId]
  ,[PositionControlPositionJobId]
  ,[PositionControlPositionRefLocationId]
  ,[PositionControlPositionCount]
  ,[PositionControlPositionEmploymentType]
  ,[PositionControlPositionLabel]) Select [PositionControlPositionId]
  ,[PositionControlPositionJobId]
  ,[PositionControlPositionRefLocationId]
  ,[PositionControlPositionCount]
  ,[PositionControlPositionEmploymentType]
  ,[PositionControlPositionLabel] from [dbo].[PositionControlPosition]

I have also searched google but couldn’t find anything like I needed,

I realize this might be a trivial question so any help will be greatly appreciated.

  • 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-18T00:14:31+00:00Added an answer on June 18, 2026 at 12:14 am

    The syntax you are looking for takes the form.

     insert [table]
     select
               [a]
             , [b]
             , 'newCValue'
             , [d]
         from
             [table]
    

    If you are not selecting all the columns then you should specify a column list on the insert

     insert [table]
             ( [a]
              ,[b]
              ,[c]
              ,[d])
     select
               [a]
             , [b]
             , 'newCValue'
             , [d]
         from
             [table]
    

    In your case i suspect you are violating your primary key and I’m assuming its an identity column so this should work.

    INSERT [dbo].[PositionControlPosition]
            (
              [PositionControlPositionJobId]
             ,[PositionControlPositionRefLocationId]
             ,[PositionControlPositionCount]
             ,[PositionControlPositionEmploymentType]
             ,[PositionControlPositionLabel]
            ) 
    SELECT
              [PositionControlPositionJobId]
             ,[PositionControlPositionRefLocationId]
             ,[PositionControlPositionCount]
             ,[PositionControlPositionEmploymentType]
             ,[PositionControlPositionLabel]
        FROM
             [dbo].[PositionControlPosition]
    

    This will duplicate the rows in PositionControlPosition excluding the primary key. If PositionControlPositionId is an identity column, it will be populated with new primary key values.

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

Sidebar

Related Questions

I would like to copy float2 values back to CPU. The results are correct
I have two tables: t1(mainid, parentid) t2(mainid, parentid) How would I copy the values
I would like to copy an array of pixel data (colors) into a texture.
I would like to copy a macro from one Excel workbook to another using
I would like to copy one object to another object, and the fields with
Lets say I have to copy a bunch of files from one location to
Currently, I have bunch of triggers that do the same thing. This is copy-pasted
I would like copy just file.xml without folder structure using overlays like this: <overlays>
I would like to copy stdout and stderr of my Perl script to a
How would I deep copy a vector in J2ME / BlackBerry?

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.