Groups | Blog | Home
all groups > sql server (alternate) > november 2004 >

sql server (alternate) : What is the value of this error?


tho_pic NO[at]SPAM yahoo.com
11/20/2004 4:22:37 PM
Today I was asked the following question but I don't know the answer.
Could you guys tell me the answer and explain why?

CREATE PROC TestProc
@I int OUTPUT
AS
SET @I=1
RAISERROR ('An error',18,50)
SET @I=@@ERROR
go

DECLARE @I int
EXEC TestProc1 @I=@I OUTPUT
select @I
go
I don't have the computer to test.

Erland Sommarskog
11/21/2004 6:06:31 PM
Tho Nguyen (tho_pic@yahoo.com) writes:
[quoted text, click to view]

The value is 50000, which is the value for user-defined values with
a string.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
Hugo Kornelis
11/21/2004 10:56:35 PM
[quoted text, click to view]

Hi Tho,

The answer:

Server: Msg 2812, Level 16, State 62, Line 3
Could not find stored procedure 'TestProc1'.

-----------
NULL

The reason: the stored procedure is created as TestProc and called as
TestProc1.

(Note - if this is mistyping on your part and not the exact original
question, see Erland's answer instead).

Best, Hugo
--

AddThis Social Bookmark Button