开发者

Stored procedure update problem

开发者 https://www.devze.com 2023-04-06 09:13 出处:网络
The stored procedure work but update nothing!! I think is about those statements if @... <>null . Thank for Help

The stored procedure work but update nothing!! I think is about those statements

if @... <>null .

Thank for Help

   ALTER PROCEDURE [dbo].[sp_UpdateLocation]

    @id_Location char(6),
    @debut_Location smalldatetime,
    @premier_Paiement smalldatetime,
    @nombre_Mensualité char(2),
    @id_Client char(6),
    @no_Termes_location char(6),
    @niv char(20)

AS

BEGIN


IF @nombre_Mensualité  <> null
   BEGIN 

        DECLARE @valeur_auto smallmoney;
        DECLARE @paiment_Mensuel smallmoney;
        SET @valeur_auto= (SELECT valeur FROM Véhicules where niv=@niv )
        SET @paiment_Mensuel= (@valeur_auto/@nombre_Mensualité)

        Update Location  
        SET paiment_Mensuel=@paiment_Mensuel,nombre_Mensualité=@nombre_Mensualité
        WHERE (@id_Location=id_Location)
    END

IF @debut_Location <> null
    BEGIN   
        Update Location  
        SET debut_Location=@debut_Location
        WHERE @id_Location=id_Location
    END

IF @premier_Paiement <> null
        BEGIN   
            Update Location  
            SET premier_Paiement=@premier_Paiement
            WHERE @id_Location=id_Location
        END

IF @id_Client <> null
        BEGIN   
            Update Location  
            SET id_Client=@id_Client
            WHERE @id_Location=id_Location
        END

IF @no_Termes_location <> null
        BEGIN   
            Update Location  
            SET no_Termes_location=@no_Termes_location
            WHERE @id_Location=id_Location
        END

IF @niv <> null
        BEGIN   
            Update Location开发者_如何学C  
            SET niv=@niv
            WHERE @id_Location=id_Location
        END



      END

      select*from Location


Instead of <> null try IS NOT NULL.

MSDN is a good resource to consult on these types of issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消