I find this usefull.
Real example.
declare @tempv1 table (Number int, AccountType varchar(255), DisplayName varchar(255), Kind int, UsagePageBreak int, PrimoPrev money, PrevPeriod money, UltimoPrev money, Primo money, Debit money, Credit money, Period money, Ultimo money, ToCurrentDate money, IndexUltimoPct money, IndexPeriodPct money, UltimoPrevOK int, UltimoOK int)
declare @tempv2 table (Number int, AccountType varchar(255), DisplayName varchar(255), Kind int, UsagePageBreak int, PrimoPrev money, PrevPeriod money, UltimoPrev money, Primo money, Debit money, Credit money, Period money, Ultimo money, ToCurrentDate money, IndexUltimoPct money, IndexPeriodPct money, UltimoPrevOK int, UltimoOK int)
insert into @tempv1
exec sp_reports_Accounting_BalanceV2
@fromaccount=1010,
@toaccount=1010,
@fromfinancialdate = '2021-01-01 00:00:00 +01:00',
@tofinancialdate = '2021-12-31 00:00:00+01:00',
@includezero=0,@ouids=NULL,@currentOrganizationalUnitId=1,@currentuserid=1,@includenotbooked=0
insert into @tempv2
exec sp_reports_Accounting_BalanceV3
@fromaccount=1010,
@toaccount=1010,
@fromfinancialdate = '2021-01-01 00:00:00 +01:00',
@tofinancialdate = '2021-12-31 00:00:00+01:00',
@includezero=0,@ouids=NULL,@currentOrganizationalUnitId=1,@currentuserid=1,@includenotbooked=0
select * from @tempv1 except select * from @tempv2
union all
select * from @tempv2 except select * from @tempv1
Ctrl+T
to output the result as text, and copy the first column line and remove extra whitespaces from there and you'll get your column names easily. To go back to Grid output pressCtrl+D
– TelefilmINSERT
theEXEC
iff your sproc isn't too complicated, 3. cheat and useOPENQUERY
. But each answer is repeated an amazing number of times, many with a downright startling number of upvotes. You've been warned. 🙈 – CoopersteinMyProcedure 'Hello', 1
– Reserve