April 23, 2010 at 4:27 am
Hi
We are getting the following error when trying to insert in to a temp table using “Insert into exec proc”.
Actually as per the statements the error should have got in any of the
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
On Examining the issue we found that error happens only if the dataset procedure has the try catch in it.
Please advise us for workarounds if any.
create proc stp_datasetwithtrycatch
as
begin
begin try
select 1,2
end try
begin catch
print 'error'
end catch
end
go
create proc stp_invoke
as
begin try
create table #temp
(a int,b int)
insert into #temp (a)
exec stp_datasetwithtrycatch
end try
begin catch
print 'error here'
end catch
go
exec stp_invoke
drop proc stp_datasetwithtrycatch
drop proc stp_invoke
April 23, 2010 at 5:24 am
vmssanthosh (4/23/2010)
Please advise us for workarounds if any
Don't specify a column list on the INSERT statement:
insert into #temp --(a)
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
April 23, 2010 at 8:13 am
hi
Thanks for your reply. but we cannot do that because we do have more columns for some other purpose and we cannot expect that proc to return all those columns.. since that particular proc is in different module, for which we do not have control. and the calle procedure also for another module.. i am working on integration of two different modules.. there i stucks..
if you need more information i will give you..
Regards
VMSSanthosh
April 23, 2010 at 7:08 pm
I believe that OPENROWSET may solve the problem you're having.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply