Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2009
    Posts
    3

    Unanswered: Getting data from one table and insert into another table

    I am trying to get specific data from a table and insert into another table. The second table structure is exactly the same. actually i am importing a excel file into the first table.
    The table structure looks like this
    CREATE TABLE [dbo].[temp](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Interval] [varchar](250) NULL,
    [calls_accepted] [varchar](150) NULL,
    [calls_answered] [varchar](150) NULL,
    [calls_abandoned] [varchar](150) NULL,
    [Avg_talk_time] [varchar](150) NULL,
    [DNIS_calls_abandoned] [varchar](150) NULL,
    [Avg_wait_time] [varchar](150) NULL,
    [TSF] [varchar](150) NULL,
    [Longest_wait_time] [varchar](150) NULL,
    [DNIS] [varchar](50) NULL
    ) ON [PRIMARY].

    Right now the data is grouped by dnis number 3393(that number will change) that would be under column namecalls_abandoned in the table.
    Row 11 It is kind of a header file in the table (DNIS Name Billing DNIS Number 3393 ).


    11 DNIS Name Billing DNIS Number 3393 NULL NULL NULL NULL NULL NULL

    12 08:30 1.00 1.00 0.00 0:03:08 0.00 0:00:02 100.00 0:00:02 NULL

    13 10:00 1.00 1.00 0.00 0:02:01 0.00 0:00:02 100.00 0:00:02 NULL

    14 15:00 1.00 1.00 0.00 0:06:24 0.00 0:00:04 100.00 0:00:04 NULL

    15 DNISTotal 3.00 3.00 0.00 0:03:51 0.00 0:00:03 100.00 0:00:04 NULL

    --------------------------------------------------------------------------------------------------------------------------------------------

    16 DNIS Name Customer Service DNIS Number 3398 NULL NULL NULL NULL NULL NULL

    17 04:00 3.00 2.00 1.00 0:00:05 33.33 0:00:02 100.00 0:00:02 NULL

    18 04:30 5.00 3.00 2.00 0:00:38 40.00 0:00:02 100.00 0:00:02 NULL

    19 Total: 1046.00 779.00 267.00 0:03:54 25.53 0:00:11 86.14 0:02:39 NULL
    -----------------------------------------------------------------------------------------------------------------------------------------------

    For example the data for 3393 is from 12 to 14 and data for 3398 is from 17 to 18. i need to insert that data in the second table.

    So i want to show the data like this for specific DNIS number. The table for the second table is exactly the same. I need to grab the dnis number and its data from the table and insert into the second table like this

    1 08:30 1.00 1.00 0.00 0:03:08 0.00 0:00:02 100.00 0:00:02 3393

    2 10:00 1.00 1.00 0.00 0:02:01 0.00 0:00:02 100.00 0:00:02 3393

    3 15:00 1.00 1.00 0.00 0:06:24 0.00 0:00:04 100.00 0:00:04 3393

    4 04:00 3.00 2.00 1.00 0:00:05 33.33 0:00:02 100.00 0:00:02 3398

    5 04:30 5.00 3.00 2.00 0:00:38 40.00 0:00:02 100.00 0:00:02 3398
    Last edited by coolaggie; 12-18-09 at 01:12. Reason: to be more clear

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •