I have a stored procedure in SQL Server 2008 that follows:
USE [Numbers]
GO
/****** Object: StoredProcedure [dbo].[thenextnum] Script Date: 09/23/2009 15:35:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[thenextnum]
@descrip varchar(50)
as
begin
declare @t table (nextseq varchar(100))
update number_definition_table
set Current_Number=Current_Number+1
output inserted.prefix_format
+(Case WHEN inserted.leading_hyphen = 'NONE' then ''
ELSE inserted.leading_hyphen END
)
--+ inserted.leading_hyphen
+right(
replicate('0',inserted.Character_Count)
+convert(varchar(50),inserted.Current_Number)
,inserted.Character_Count)
+(Case WHEN inserted.trailing_hyphen = 'NONE' then ''
ELSE inserted.trailing_hyphen END
) into @t
where descriptor = @descrip
select nextseq from @t
end
It needs to get passed in a value from VB.net for the @descrip variable. This value represents a unique value found in the table for the field descriptor.
I need to get back the result from the @t variable which should be a sequential number that the stored procedure assembles. The stored procedure works as needed. What would the code in VB.net look like to pass in the value for @descriptor and accept back the value for @t.
Thanks,