Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Checking NULL values in SQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 204
    Comment on it

    While working with SQL you always face columns with NULL values. For avoiding that you can put a check on it. NULL value is something that is different from nothing and space

    ALTER proc [dbo].[sp_GetMailToEmployee]
    (
    @EmployeeID int 
    
    )
    as
    
    begin
    
    declare @GetMail varchar(200)
    declare @status int
    set @GetMail=(select EmployeeEmail from EmployeeDetails where EmployeeId=@Employeeid)
    if(@GetMail=NULL)
    
    begin
    set @status=0
    end
    
    else
    
    begin
    set @status=1
    end
    
    select @GetMail as 'EmployeeEmail',@status as 'Status'
    end

     

    SQL Server

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: