Saving two different records having different number of columns in one table.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • venkatanarasimhaa
    New Member
    • Dec 2007
    • 20

    Saving two different records having different number of columns in one table.

    Hi,

    Thanks in advance.

    I am very basic SQL user. I would like to store records having different coulmns in one table. Is it possible?
    Ex.
    Table 1 -> Fields -> Docid, Received_date, process_start_t ime, process_end_tim e, Time spent. (No of columns : 5)

    Table 2 -> Fields -> Docid, Received_date, process_start_t ime, process_pause_t ime, Process_restart _time, process_end_tim e, Time spent. (No of columns : 7)

    How can I save these two records in the same table.

    Please help me out..

    Waiting for your reply.

    Regards,

    Venkat.
  • gpl
    New Member
    • Jul 2007
    • 152

    #2
    Originally posted by venkatanarasimh aa
    I would like to store records having different coulmns in one table. Is it possible?
    Ex.
    Table 1 -> Fields -> Docid, Received_date, process_start_t ime, process_end_tim e, Time spent. (No of columns : 5)

    Table 2 -> Fields -> Docid, Received_date, process_start_t ime, process_pause_t ime, Process_restart _time, process_end_tim e, Time spent. (No of columns : 7)
    This is not possible - it breaks every rule of databases

    However, if you created a table which contained ALL of the columns, you could enter NULL for the columns that were not relevant to that particular row.
    Graham

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Originally posted by venkatanarasimh aa
      Hi,

      Thanks in advance.

      I am very basic SQL user. I would like to store records having different coulmns in one table. Is it possible?
      Ex.
      Table 1 -> Fields -> Docid, Received_date, process_start_t ime, process_end_tim e, Time spent. (No of columns : 5)

      Table 2 -> Fields -> Docid, Received_date, process_start_t ime, process_pause_t ime, Process_restart _time, process_end_tim e, Time spent. (No of columns : 7)

      How can I save these two records in the same table.

      Please help me out..

      Waiting for your reply.

      Regards,

      Venkat.
      I hope this is not your assignment....

      Yes you can. As long as the target table has all the columns that you want populated.

      Based on your example, your target table should look exactly like Table2.

      -- CK

      Comment

      Working...