Hello! I am new to transact sql and would like and have the following situation. I have a tableA that has the column list of a second tableB. That's it! In table B the column names are the same as those stored in table A. Then you would use the SELECT information in table B and store it in a third tabelac. It would be something like:
@Coluna = SELECT nomecoluna FROM tabelaA;
WHILE (!@Coluna)
BEGIN
INSERT INTO TABLE tabelaC (data, tag)
SELECT data, @Coluna from tabelaB;
END
Note: The column tag in tableC would receive as value the column name (@column)
I hope someone is encouraged to help me! Abs!