Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Raise an exception from within a SP
Message
From
15/09/2006 11:54:21
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01076224
Message ID:
01154157
Views:
22
>>>>did they replace goto with try/catch in t-sql or you are talking about writing sprocs in vb/c#?
>>>
>>>try endtry catch
>>>
>>>>im doing most of the work in oracle/pl-sql and i like this language much better than t-sql.
>>>
>>>sql2005's t-sql reduce the gap, but p-sql is some years ahead.
>>
>>How do you return Return code into VFP from SP?
>>
>>Thanks.
>
>
>DECLARE @return INT
>
>EXEC @return=[db].[user].[procedure]
>
>SELECT @return
>
>No, I meant in VFP code how can you get return. Anyway, I found an answer >in Sergey Berezniker's reply, but I lost the thread again...

Try,
SP side-
   if @@error<>0 return -1
or
   if @@error<>0   
   begin
    raiserror(' Customized error message here',19,1) with log 
    return -1
   end
-----------------------------------------------------------------
VFP side -
   if sqlexec(nsqlhnd,"exec SP_name")<0
      AERROR(a_err)
  *   DISPLAY MEMORY LIKE a_err
      lcerr=STREXTRACT(a_err(2),"[SQL Server]")
      Messagebox(lcerr,16,"")
   endif 
Steven
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform