By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

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

P: 20
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_time, process_end_time, Time spent. (No of columns : 5)

Table 2 -> Fields -> Docid, Received_date, process_start_time, process_pause_time, Process_restart_time, process_end_time, 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.
Apr 2 '08 #1
Share this Question
Share on Google+
2 Replies


100+
P: 152
gpl
I would like to store records having different coulmns in one table. Is it possible?
Ex.
Table 1 -> Fields -> Docid, Received_date, process_start_time, process_end_time, Time spent. (No of columns : 5)

Table 2 -> Fields -> Docid, Received_date, process_start_time, process_pause_time, Process_restart_time, process_end_time, 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
Apr 2 '08 #2

ck9663
Expert 2.5K+
P: 2,878
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_time, process_end_time, Time spent. (No of columns : 5)

Table 2 -> Fields -> Docid, Received_date, process_start_time, process_pause_time, Process_restart_time, process_end_time, 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
Apr 2 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.