[dba-SQLServer] Stored Procedure Help Required

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Feb 26 09:31:53 CST 2004


To all,
 
I’m ok with basic stored procedure’s, however I want to try something just a little more advanced.  I have the following SP at the moment:
 
CREATE PROCEDURE [genesis_insert_AvailabilityAll]
            (@PayrollNo_2   [nvarchar](35),
             @JobDate_3     [datetime],
             @AvailCode_4   [nvarchar](2),
             @Type_5          [int])
 
AS 
 
SET NOCOUNT ON
 
INSERT INTO [GenesisTest].[dbo].[tblAvailabilityAll] 
             (          [PayrollNo],
                        [JobDate],
                        [AvailabilityCode],
                        [Type]) 
 
VALUES 
            ( @PayrollNo_2,
              @JobDate_3,
              @AvailCode_4,
              @Type_5)
 
The above SP inserts an availability record into tblAvailabilityAll, however the employee has to be given three types of availability 0, 1, 2 I have a Visual Basic FE and have a loop which passes the PayrollNo, JobDate, AvailCode and Type.  As Type is the only value that changes, is there a way I could just pass the SP PayrollNo, JobDate and Availcode and have the SP increment the type ?
 
Thanks in advance for any help received.
 
Paul Hartland
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month 
www.freeserve.com/anytime


More information about the dba-SQLServer mailing list