Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    53

    Unanswered: help with temp table!

    Need a little help ...i am trying to create a temp table with a result set from a record query that yields, a two column multiple row resultset.

    I would like to obtain the second column from the first result set and make that the first row in the first column of my temp table, then the first column from the second result set and make that the first row in the second column of my temp table, etc.

    I.E

    resultset:

    color l number
    green l 0
    blue l 1
    red l 2
    black l 3

    TO #temptable

    A l B
    0 l blue
    1 l red
    2 l black

    I have tried to do this

    but yielded :

    A l B
    0 l NULL
    1 l NULL
    2 l NULL
    NULL l blue
    NULL l red
    NULL l black

    Not exactly the results I need I would GREATLY appreciate any help!!!

    THANK U!!

  2. #2
    Join Date
    May 2004
    Location
    The Netherlands
    Posts
    52
    how does your sql-statement look like?

  3. #3
    Join Date
    Jul 2004
    Posts
    53
    I have this in a stored procedure that passes a datetime and room:

    create table #table (starttime int, endtime int)
    insert #table (starttime)
    SELECT end_time
    FROM times
    WHERE type= 'R'
    and room = @room
    and start_date= @sdate
    and end_time <> 1440
    ORDER BY start_date, end_date, start_time, end_time


    insert #table (endtime)
    SELECT start_time
    FROM times
    WHERE type = 'R'
    and room = @room
    and start_date = @sdate
    and start_time <> 0
    ORDER BY start_date, end_date, start_time, end_time
    select * from #table
    drop table #end

Posting Permissions

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