+ Reply to Thread
Results 1 to 2 of 2

Thread: stored procedure conditioning

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    13

    stored procedure conditioning

    Hi , I have a stored procedure that evaluate multiple conditions on the different parameters in one go :
    Code:
    AS
    BEGIN
        DECLARE @FIVALUE int
        DECLARE @GARRISON nvarchar(255)
        DECLARE @ASSETTYPE nvarchar(255)
    
        IF (  ( @GARRISON IS NOT 'Netheravon' 
                AND @GARRISON IS NOT 'Ludgershall'
              )
              AND @INTERRUPT >= 5)
            BEGIN
            END
        ELSE
    END
    What is the best syntax for this?

  2. #2
    You can use.
    Code:
    IF ((@GARRISON != 'Netheravon' AND @GARRISON != 'Ludgershall') )
    AND @INTERRUPT >= 5)
    And this is the exact sctipt I used for testing, and works exactly as expected. SQL Server 2008
    Code:
    DECLARE @INTERRUPT INT
    DECLARE @GARRISON nvarchar(255)
    
    SET @GARRISON = 'Test'
    SET @INTERRUPT = 10
    
    IF (@GARRISON NOT IN ('Netheravon' ,'Ludgershall' )
       AND @INTERRUPT >= 5)  
    BEGIN
    SELECT 1
    END

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts