none
Create a view from two tables having different number of Columns RRS feed

  • Question

  • Hi,

    I want to construct a view in T-SQL by combining (like UNION ALL) two or more tables with different no. of columns.

    Eg. TABLE1 contains 3 columns (all VARCHAR) and 2 rows, TABLE2 contains 4 columns (all VARCHAR) and 4 rows. I would like the resultant view to be of 4 columns and 6 rows by combining these two tables. Retaining column names is not important

    PS :  These tables are determined dynamically, so there is no way of knowing how many columns would be there beforehand. The only guarantee is that the ALL THE COLUMNS would be of the type VARCHAR 


    • Edited by devROGUE Monday, May 7, 2012 7:21 AM
    Monday, May 7, 2012 7:17 AM

Answers

All replies