I'm trying to write a VB CLR stored procedure that will set the return statu
s
to 0 or 1 depending on whether the CLR was successful or not. How do I do
that? Basically I want to use the following T-SQL code to call my CLR and
set the @.return_status
declare @.return_status int
EXEC @.return_status=My_CLR_SP
select @.return_statusI would like to know how to do this as well. Can anyone help us?
Greg Larsen wrote:
> I'm trying to write a VB CLR stored procedure that will set the return sta
tus
> to 0 or 1 depending on whether the CLR was successful or not. How do I do
> that? Basically I want to use the following T-SQL code to call my CLR and
> set the @.return_status
> declare @.return_status int
> EXEC @.return_status=My_CLR_SP
> select @.return_status|||Greg,
I found this at http://msdn2.microsoft.com/en-us/library/ms131094.aspx.
I tried it out and it works great.
Here is a really simple example:
<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Function TestProc() As Int32
TestProc = 1
End Function
And the test script:
DECLARE @.result AS int
EXEC @.result = TestProc
PRINT @.result
Tom
Greg Larsen wrote:
> I'm trying to write a VB CLR stored procedure that will set the return sta
tus
> to 0 or 1 depending on whether the CLR was successful or not. How do I do
> that? Basically I want to use the following T-SQL code to call my CLR and
> set the @.return_status
> declare @.return_status int
> EXEC @.return_status=My_CLR_SP
> select @.return_status|||Thank you for the VB example.
I got mine to working by writing it in C # and doing the following:
[Microsoft.SqlServer.Server.SqlProcedure]
public static int TestProc()
{ return=1;}|||You're welcome. Thanks for posting the C# example.
Tom
Greg Larsen wrote:
> Thank you for the VB example.
> I got mine to working by writing it in C # and doing the following:
> [Microsoft.SqlServer.Server.SqlProcedure]
> public static int TestProc()
> { return=1;}
Showing posts with label return_status. Show all posts
Showing posts with label return_status. Show all posts
Subscribe to:
Posts (Atom)