You actually can do this but the technique is highly funky. By establishing a linked server (to itself) and using OPENQUERY you can create the table by using "set fmtonly on".-- add 'loopback' linkedserver if exists (select * from master..sysservers where srvname = 'loopback') exec sp_dropserver 'loopback'goexec sp_addlinkedserver @server = N'loopback', @srvproduct = N'', @provider = N'SQLOLEDB', @datasrc = @@servernamego--just create the empty table with this:--select * into #t from openquery(loopback, 'set fmtonly on exec sp_who') --insert #t exec sp_who--create and insert with this:select * into #t from openquery(loopback, 'exec sp_who') select * from #t--drop table #tgoif exists (select * from master..sysservers where srvname = 'loopback') exec sp_dropserver 'loopback'
Be One with the OptimizerTG