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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:59:15+00:00 2026-05-24T22:59:15+00:00

I need to clone table rows but am struggling with this syntax. My train

  • 0

I need to clone table rows but am struggling with this syntax. My train of thought went like this:

DECLARE @myPk Uniqueidentifier
SET @myPK = NewID()

INSERT INTO my.table (pk, fullname, two, three)
SELECT (@myPK, "Clone of " + fullname , two, three) FROM my.table where pk= @pk

but of course the syntax is incorrect. I’ve also tried

INSERT INTO my.table (pk, fullname, two, three)
SELECT (@myPK = newId(), "Clone of " + fullname , two, three) FROM my.table where pk= @pk    

(I hope you can see where I’m trying to go :-/)

Short of declaring variables for each table column (not practical due to high number of columns) or using #tempTables (not permitted in this code shop) is there a neat syntax for doing this?

Thanks for reading.

  • 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-24T22:59:16+00:00Added an answer on May 24, 2026 at 10:59 pm

    Don’t enclose your SELECTed fields in parentheses.

    Try:

    INSERT INTO my.table (pk, fullname, two, three)
    SELECT @myPK, 
           "Clone of " + fullname , 
           two, 
           three 
    FROM my.table
    where pk= @pk
    

    When you enclose everything in parentheses in a SELECT statement the engine tries to make that one value, which is not possible.

    For instance, try SELECT (1,2,3) which will throw a syntax error also, while SELECT 1,2,3 works fine.

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

Sidebar

Related Questions

I have a table that looks like this: <table name=exercises id=workout-table> <tr> <th>Name</th> <th>Reps/Intervals</th>
Ok, I would like to use a CASE STATEMENT for this, but I am
I have application working with SQLite DB(table with two rows) I need to recieve
I have an object not written by myself that I need to clone in
I need a method that creates an empty clone of an object in a
I need a shallow copy of an java ArrayList , should I use clone()
I'm trying to dedup a table, where I know there are 'close' (but not
I'm trying to do a query to filter on rows from one table and
I have made the following search script but can only search one table column
For an application we are developing we need to read n rows from a

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.