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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:31:13+00:00 2026-06-08T06:31:13+00:00

So I’m trying to insert a small batch of rows (<10) at once into

  • 0

So I’m trying to insert a small batch of rows (<10) at once into a table. The data is in a table-valued parameter, but I need to add some extra columns to it that are common to all the rows before inserting it. I’ve tried two ways of doing this:

INSERT INTO endTable
([col1],[col2],[commoncol1],[commoncol2])
SELECT
t.col1, t.col2, @CommonValue1, @CommonValue2
FROM startTable t

I’ve also tried to do it by putting the common variables into a temporary table variable, and then cross joining it with startTable, like this:

DECLARE @tempTable TABLE([temp1],[temp2])
INSERT INTO @tempTable(temp1,temp2) VALUES (@CommonValue1, @CommonValue2)

INSERT INTO endTable
([col1],[col2],[commoncol1],[commoncol2])
SELECT
a.col1, a.col2, b.temp1, b.temp2
FROM startTable a CROSS JOIN @tempTable b

Both of these attempts give the same error if and only if startTable has multiple rows:

Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !=, <, <= , >, >= or when the subquery is used as
an expression.

I was hoping to accomplish these inserts without resorting to a loop, but I’m not incredibly familiar with SQL, so I don’t know if I’m out of luck, or if I’m missing something obvious. Any help would 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-08T06:31:14+00:00Added an answer on June 8, 2026 at 6:31 am

    Since your INSERT statement does not have a subquery, the error message doesn’t make sense. My guess is that you have a trigger on endTable that is throwing the error.

    Run the following query to see if you have any triggers on endTable. If you do, then you will need to inspect the SQL in the trigger to see why it is throwing the error.

    SELECT * 
    FROM sys.triggers 
    WHERE parent_id = OBJECT_ID(N'endTable')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I need to clean up various Word 'smart' characters in user input, including but
I want to construct a data frame in an Rcpp function, but when I
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

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.