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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:31:40+00:00 2026-05-31T06:31:40+00:00

How to store the result set of the given query in a new table.

  • 0

How to store the result set of the given query in a new table.

select   d1.year,d1.month,d1.Circle_code,d1.Call_type_code,d1.DescId,d1.CustId,
d1.call_logged,d2.Call_Cancel
from dbo.Table_M_CALL_LOGGED as d1 
join dbo.Table_M_CALL_CANCEL as d2 on

d1.year=d2.year
and d1.month=d2.month
and d1.Circle_Code=d2.Circle_Code
and d1.Call_Type_Code=d2.Call_Type_Code
and d1.DescId=d2.DescId
and d1.CustId=d2.custID
  • 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-31T06:31:42+00:00Added an answer on May 31, 2026 at 6:31 am

    I am creating here new temporary table to just you show how to insert query result directly into table….

    --Creating new TempTable
    CREATE TABLE #tempTable(tempyear nvarchar(20),tempmonth nvarchar(20),Circle_code   nvarchar(20),Call_type_code nvarchar(20),
    DescId nvarchar(20),CustId nvarchar(20),call_logged nvarchar(30),Call_Cancel nvarchar(20));
    
    --Inserting the data into tempTable
    INSERT INTO #tempTable(tempyear,tempmonth,Circle_code,Call_type_code,DescId,CustId,call_logged,Call_Cancel)
                        select   d1.year,d1.month,d1.Circle_code,d1.Call_type_code,d1.DescId,d1.CustId,
                        d1.call_logged,d2.Call_Cancel
                        from dbo.Table_M_CALL_LOGGED as d1 
                        join dbo.Table_M_CALL_CANCEL as d2 on
                        d1.year=d2.year
                        and d1.month=d2.month
                        and d1.Circle_Code=d2.Circle_Code
                        and d1.Call_Type_Code=d2.Call_Type_Code
                        and d1.DescId=d2.DescId
                        and d1.CustId=d2.custID
    

    Below method is used when table is not created earlier and needs to be created when data from one table is to be inserted into newly created table from another table. New table is created with same data types as selected columns.

                        SELECT   d1.year,d1.month,d1.Circle_code,d1.Call_type_code,d1.DescId,d1.CustId,
                        d1.call_logged,d2.Call_Cancel
                        INTO new_table   --Here inserting into new table
                        FROM dbo.Table_M_CALL_LOGGED AS d1 
                        join dbo.Table_M_CALL_CANCEL AS d2 ON
                        d1.year=d2.year
                        AND d1.month=d2.month
                        AND d1.Circle_Code=d2.Circle_Code
                        AND d1.Call_Type_Code=d2.Call_Type_Code
                        AND d1.DescId=d2.DescId
                        AND d1.CustId=d2.custID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store the result of select query in an array in C#.
I'm creating a temp table that's the result of a stored procedure's result set.
How would I store the result of a select statement so I can reuse
I serialize some configuration objects and store the result bytes within a database. new
I have the following MySQL query, which produces the result I want: SELECT `l`.`status`,
I have a MYSQL stored procedure SP1() that returns a result set. I want
In LINQ to Entities, I map the result set of a stored procedure to
I have a table from which I query data to display resultset using stored
So I am trying to store the result from a render target into an
I have a table, Messages, which is set out as follows: This table stores

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.