Purushottam Rathore
How to check if variable is NULL In Stored Procedure?
By Purushottam Rathore in SQL Server on Sep 01 2009
  • Purushottam Rathore
    Sep, 2009 1

    Create PROCEDURE [dbo].[UpdateRecord]
    (
       @empId int,
       @name varchar(200),
    )

    AS

    DECLARE
    @chkName varchar(200)

    SET @chkName=(SELECT TOP 1 Emp_Name FROM Employee WHERE EmpId=@empId )

    IF @chkName IS NULL

    BEGIN
       UPDATE Employee SET Emp_Name = @name WHERE EmpId = @empId
    END

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS