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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:13:28+00:00 2026-05-23T02:13:28+00:00

I got a table with approx 13066 records in which I want to add

  • 0

I got a table with approx 13066 records in which I want to add all other records from another table (having approx. 1346 records). There is a stored procedure which does the insert and I want to use it for all records to be inserted. Can anyone please help?

  • 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-23T02:13:28+00:00Added an answer on May 23, 2026 at 2:13 am

    I may have misinterpreted your question but it seems like that you want to execute a stored procedure and insert the results of the stored procedure in to your main table.

    To do this you can do:

    INSERT INTO dbo.YourMainTable
    EXEC dbo.YourStoredProcedureName
    

    EDIT:

    The only way I can think of doing this would be to use a cursor.

    DECLARE @PrimaryKeyFieldInTable2 int
    
    DECLARE spCur CURSOR LOCAL FOR
    
       SELECT PrimaryKetCol From Table2
    
    OPEN spCur
    
    FETCH NEXT FROM spCur INTO @PrimaryKeyFieldInTable2
    
    
    WHILE @@FETCH_STATUS = 0 BEGIN
    
        INSERT INTO dbo.Table1
        EXEC dbo.YourStoredProceudre @PrimaryKeyFieldInTable2
    
        FETCH NEXT FROM spCur INTO @PrimaryKeyFieldInTable2 
    
    END
    
    CLOSE spCur
    DEALLOCATE spCur
    

    This assumes that your Stored Procedure accepts one parameter to select each row from Table2.

    This isn’t the best use of SQL Server but if you really must do it this way then I can’t think of any other way.

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

Sidebar

Related Questions

I got a table named clients in MySql. I want to list all the
I got a table in my HTML and I want to generate new temporary
I've got a table of a parameters, values, and times at which those values
I got a table variable @RQ , I want it updated using a table-valued
I got a Table which has two fields: Point, and Level, with some sample
Well, I got table Workers in my DB. There are 4 columns id ,
I got a table which uses jQuery UI's sortable. The first column contains the
I've got a table with approx 7 million rows of data. The schema is
I was trying to update approx 20,000 records in a table by using statements
Ive got table: UserA, UserB, numberOfConnections I would like to write query which returns

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.