I would like to get a list of columns in a temporary table, similar to the INFORMATION_SCHEMA.columns view. However, this code:
select * from tempdb.INFORMATION_SCHEMA.columns where TABLE_CATALOG = 'tempdb' and TABLE_NAME like '#myTemporaryTable%'
returns one row per column and per session. Is it safe to do this:
select distinct column_name,data_type from tempdb.INFORMATION_SCHEMA.columns where TABLE_CATALOG = 'tempdb' and TABLE_NAME like '#myTemporaryTable%'
I have a feeling that this is not the case, even if you pull up a similar sentence so that it does not match myTemporaryTable and myTemporaryTable2.
source share