Wednesday, February 15, 2012

Error 208 while executing procedure

HI
Here is a piece of code which i execute while running a stored procedure,
when i trace the procedure i get error 208 , the inner proc which i execute
is there in the database but still i get error 208 when i execute the outer
procedure, here is the code for outer proc which executes the inner proc
IF @.Reserves <> 0 AND @.cDeathFundEventStatus = 'DA' -- @.NonPIA = 1
BEGIN
SET @.cResult = NULL
EXEC dbo.ap_Dth_Settle_Trans_HandleAssets
@.cDeathBenefitOptionID,
'NONPIASR',
NULL,
@.cResult OUTPUT
---
-- Error Handler
---
-- Check system error
SET @.nError = @.@.ERROR
IF @.nError <> 0
BEGIN
SET @.cOutput = @.cProcessName + '~(' + CAST(@.nError AS VARCHAR(10))+
')5:System error calling sp ap_Dth_Settle_Trans_HandleAssets'
GOTO errHandler
END -- (@.nError <> 0)
-- Check for logic error
IF @.cResult IS NOT NULL -- Success = NULL
BEGIN
SET @.cOutput = @.cResult -- Logic failure in called sp
GOTO errHandler
END -- @.cResult IS NOT NULL (Success = NULL)
ENDRodger,
Is 'dbo' the owner of the inner procedure?
See "Error 208" in BOL.
AMB
"Rodger" wrote:

> HI
> Here is a piece of code which i execute while running a stored procedure,
> when i trace the procedure i get error 208 , the inner proc which i execut
e
> is there in the database but still i get error 208 when i execute the oute
r
> procedure, here is the code for outer proc which executes the inner proc
> IF @.Reserves <> 0 AND @.cDeathFundEventStatus = 'DA' -- @.NonPIA = 1
> BEGIN
> SET @.cResult = NULL
> EXEC dbo.ap_Dth_Settle_Trans_HandleAssets
> @.cDeathBenefitOptionID,
> 'NONPIASR',
> NULL,
> @.cResult OUTPUT
> ---
> -- Error Handler
> ---
> -- Check system error
> SET @.nError = @.@.ERROR
> IF @.nError <> 0
> BEGIN
> SET @.cOutput = @.cProcessName + '~(' + CAST(@.nError AS VARCHAR(10))+
> ')5:System error calling sp ap_Dth_Settle_Trans_HandleAssets'
> GOTO errHandler
> END -- (@.nError <> 0)
> -- Check for logic error
> IF @.cResult IS NOT NULL -- Success = NULL
> BEGIN
> SET @.cOutput = @.cResult -- Logic failure in called sp
> GOTO errHandler
> END -- @.cResult IS NOT NULL (Success = NULL)
> END|||Hi
If you can script the DDL, example data and the procedures so that the
problem is re-creatable in another database, then you may solve it, otherwis
e
they could be posted!
My only guess is that there is some spurious character(s) in there.
John
"Rodger" wrote:

> HI
> Here is a piece of code which i execute while running a stored procedure,
> when i trace the procedure i get error 208 , the inner proc which i execut
e
> is there in the database but still i get error 208 when i execute the oute
r
> procedure, here is the code for outer proc which executes the inner proc
> IF @.Reserves <> 0 AND @.cDeathFundEventStatus = 'DA' -- @.NonPIA = 1
> BEGIN
> SET @.cResult = NULL
> EXEC dbo.ap_Dth_Settle_Trans_HandleAssets
> @.cDeathBenefitOptionID,
> 'NONPIASR',
> NULL,
> @.cResult OUTPUT
> ---
> -- Error Handler
> ---
> -- Check system error
> SET @.nError = @.@.ERROR
> IF @.nError <> 0
> BEGIN
> SET @.cOutput = @.cProcessName + '~(' + CAST(@.nError AS VARCHAR(10))+
> ')5:System error calling sp ap_Dth_Settle_Trans_HandleAssets'
> GOTO errHandler
> END -- (@.nError <> 0)
> -- Check for logic error
> IF @.cResult IS NOT NULL -- Success = NULL
> BEGIN
> SET @.cOutput = @.cResult -- Logic failure in called sp
> GOTO errHandler
> END -- @.cResult IS NOT NULL (Success = NULL)
> END|||Thanks Guys .. I found out the problem my stored procedure had lot of
temporary tables so it gave me a error while executing this piece of code
which executes a inner stored procedure, when i try global temporary table i
t
works
Thanks
"John Bell" wrote:
> Hi
> If you can script the DDL, example data and the procedures so that the
> problem is re-creatable in another database, then you may solve it, otherw
ise
> they could be posted!
> My only guess is that there is some spurious character(s) in there.
> John
> "Rodger" wrote:
>|||Rodger,
If you're only seeing the 208 errors when monitoring the exception event in
Profiler, you likely haven't got an issue at all with the original code.
Exception events reported in Profiler may or may not actually get reported t
o
the application calling SQL Server. There are cases in which SQL Server
internally raises and then handles the 208 exception. As a result, it gets
captured by Profiler, but the client application never encounters an error.
The time when this is most often encountered is with exception event 208
(basically, object not found). This often happens with deferred name
resolution in SQL Server. Basically, whenever SQL Server is parsing a query
,
it attempts to resolve the names of all tables referenced in the query. In
some cases, such a temp tables, these might not exist yet. Internally, this
raises the 208 exception event. However, SQL Server looks at the situation
and determines that the issue can be addressed by deferred name resolution
(i.e. it doesn't worry about it until someone actually executes the query).
As a result of this handling, processing proceeds normally and no error is
reported to the client application despite being reported within Profiler.
To see this behavior, create and then run the following stored procedure in
Query Analyzer. If you monitor the exception event in Profiler, you should
see exception 208 pop up, but execution is reported as successful within
Query Analyzer.
CREATE PROCEDURE proc_test_deferred_name_resolution
AS
CREATE TABLE #test(c1 int)
SELECT * FROM #test
DROP TABLE #test
GO
EXEC proc_test_deferred_name_resolution
GO
For additional information on deferred name resolution in SQL Server, please
see the Books Online topic "Deferred Name Resolution and Compilation"
(http://msdn.microsoft.com/library/d...
s_07_5wa6.asp)
- Chris Cubley
"Rodger" wrote:
> Thanks Guys .. I found out the problem my stored procedure had lot of
> temporary tables so it gave me a error while executing this piece of code
> which executes a inner stored procedure, when i try global temporary table
it
> works
> Thanks
> "John Bell" wrote:
>

No comments:

Post a Comment