asked on September 15, 2015

I am posting in response to the post found [Here] - I am unable to get the condition to work in my Stored Procedure within Forms.  I can execute the SP in SQL Server Management Studio, but when I attempt to run it in Forms, I get a number, then when the field (notused) changes, it loads a new number.  This is not ideal because it would cause numbers to become unused.  I've posted my SP below, please let me know if anyone has any code that is working to accomplish this...  

USE [LFForms]
GO
/****** Object:  StoredProcedure [dbo].[sp_increment]    Script Date: 9/15/2015 12:48:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
       ALTER PROCEDURE [dbo].[sp_increment] 
       @notused varchar(50) = NULL --Initially set field value to null
	   AS
	   IF @notused IS NOT NULL
       BEGIN
	   Declare @myvalue int
       select @myvalue= [RequestNumber] from dbo.RequestNumber where name = 'access'
       update dbo.RequestNumber set [RequestNumber] = @myvalue + 1 where name = 'access'
       Declare @myTable table
       (
       [RequestNumber] nvarchar(50)
       )
       INSERT INTO @myTable ([RequestNumber]) values (@myvalue)
       select top 1 * from @mytable
       END

 

Thanks,

Nate

0 0