I have a question regarding my attempt to combine two tables in sql server…
I have one table that has about 30 columns (table a), and a second table that has about 5 (table b), those 5 being present in the 30 column table. I want to be able to add table b to the end of table a, and just use 0 values for the nonexistent columns in the new rows.
Is there a way to do this? Obviously a regular union wouldnt work if I want to keep the other columns in table a.
The basic idea is this, assuming
col3does not exist inTableB:Be careful to keep the data types the same within each column.
To keep the
TableBrecords at the end, do: