Saturday, 5 February 2022

when input 0 make it null

 


ALter PROC [Master].[usp_AccountPageView]     0,'false',0,10 

    

  @AgentID int,

  

 @Status bit,    

 @PageNo smallint,    

 @Rows smallint    

 

AS     

BEGIN    

     SET  @AgentID = CASE WHEN @AgentID= 0 THEN 'null' END

 ;with AdminStatus as (select lookupid,lookupdescription from config.lookup where LookupCategory='ADMINSTATUS')    

 SELECT Ac.[ID], Ac.[AgentID], Ac.[AccountName], Ac.[ContactPerson], Ac.[EmailID], Ac.[Password], Ac.[MobileNo], Ac.[AdminStatus], Ac.[Status], Ac.[CreatedOn], Ac.[CreatedBy],    

 ISNULL(b.LookupDescription,'') As AdminStatusDescription,Ag.AgencyName ,Ac.ProfileStatus    

 FROM   [Master].[Account] Ac    

 left outer join AdminStatus b on     

  Ac.adminstatus = b.LookupID    

 Left Outer Join Master.Agent Ag ON    

  Ac.AgentID = Ag.ID    

 Where     

  Ac.AgentID =  ISNULL(@AgentID, 0 )    

  And Ac.Status = @Status    

 ORDER BY Ac.[ID]      

 OFFSET @Rows * @PageNo ROWS    

 Fetch NEXT @Rows ROWS ONLY    

    

END    

     

No comments:

Post a Comment

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...