INSERT INTO with variable number of columns
Posted on 2007-11-16
I have a stored procedure that returns a SELECT statement but that could either have one or two columns in it :
SELECT Field1, Field2
I don't know in advance, what that SP will return and I can't modify it...
I would like to do an INSERT INTO statement into a 2 column table (the second column accepts NULLs) with the valuses returned from my SP. But how can I build this statement not knowing if I'll get one or two columns ? Is this possible ?