Monday, October 20, 2014

Stored procedure for navigation buttons

Posted by Gnani Palepu  |  No comments


 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  

 USE [LMS]  
 GO  
 /****** Object: StoredProcedure [dbo].[USP_GET_LEAVE_APPLICATION]  Script Date: 06/23/2014 11:19:36 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 -- =============================================  
 -- Author     : GNANI  
 -- Create date     : 21/05/2014   
 -- Description     : Stored Procedure to GET LEAVE_APPLICATION  
 -- =============================================  
 ALTER PROCEDURE [dbo].[USP_GET_LEAVE_APPLICATION]  
       @Type               INT = 0  
      ,@COND               BIGINT = 0  
      ,@ResponseCode     BIGINT OUTPUT  
 AS  
 BEGIN  
      DECLARE @EMPID INT  
      BEGIN TRY  
      IF (@Type = 1) -- FIRST  
       BEGIN  
           SELECT @EMPID = MIN(EMPID) FROM MstLeaveApplication WITH(NOLOCK)  
           SELECT EMPID,EMPCODE,EMPNAME,LOCATION,DEPARTMENT,LEAVEPERIODFROM,LEAVEPERIODTO,REASONFORLEAVE,HRDEPTREMARKS,LEAVESANCNSIGN,LEAVENOTSANCNREMARKS,EARNEDLEAVE,OTHERLEAVE,LOSSOFPAY,DIRECTORREMARKS FROM MstLeaveApplication   
           WHERE EMPID = @EMPID   
           SET @ResponseCode=@@ROWCOUNT  
      END  
      ELSE IF (@Type = 2) -- PREV  
      BEGIN  
           SELECT @EMPID = ISNULL(EMPID,0) FROM MstLeaveApplication WITH (NOLOCK) WHERE EMPID = ( SELECT TOP 1 EMPID FROM MstLeaveApplication WHERE EMPID < @COND ORDER BY 1 DESC)  
           SELECT EMPID,EMPCODE,EMPNAME,LOCATION,DEPARTMENT,LEAVEPERIODFROM,LEAVEPERIODTO,REASONFORLEAVE,HRDEPTREMARKS,LEAVESANCNSIGN,LEAVENOTSANCNREMARKS,EARNEDLEAVE,OTHERLEAVE,LOSSOFPAY,DIRECTORREMARKS FROM MstLeaveApplication   
           WHERE EMPID = @EMPID   
           SET @ResponseCode=@@ROWCOUNT  
      END  
      ELSE IF (@Type = 3) -- NEXT  
      BEGIN  
           SELECT @EMPID = ISNULL(EMPID,0) FROM MstLeaveApplication WITH (NOLOCK) WHERE EMPID = ( SELECT TOP 1 EMPID FROM MstLeaveApplication WHERE EMPID < @COND ORDER BY 1 ASC)  
           SELECT EMPID,EMPCODE,EMPNAME,LOCATION,DEPARTMENT,LEAVEPERIODFROM,LEAVEPERIODTO,REASONFORLEAVE,HRDEPTREMARKS,LEAVESANCNSIGN,LEAVENOTSANCNREMARKS,EARNEDLEAVE,OTHERLEAVE,LOSSOFPAY,DIRECTORREMARKS FROM MstLeaveApplication   
           WHERE EMPID = @EMPID   
           SET @ResponseCode=@@ROWCOUNT  
      END  
      ELSE IF (@Type = 4) -- LAST  
      BEGIN  
           SELECT @EMPID = MAX(EMPID) FROM MstLeaveApplication WITH(NOLOCK)  
           SELECT EMPID,EMPCODE,EMPNAME,LOCATION,DEPARTMENT,LEAVEPERIODFROM,LEAVEPERIODTO,REASONFORLEAVE,HRDEPTREMARKS,LEAVESANCNSIGN,LEAVENOTSANCNREMARKS,EARNEDLEAVE,OTHERLEAVE,LOSSOFPAY,DIRECTORREMARKS FROM MstLeaveApplication   
           WHERE EMPID = @EMPID   
           SET @ResponseCode=@@ROWCOUNT  
      END  
      ELSE IF (@Type = 5)  
      BEGIN  
           SELECT * FROM MstLeaveApplication WITH(NOLOCK) WHERE EMPID = @EMPID  
           SET @ResponseCode=@@ROWCOUNT  
      END  
  END TRY  
  BEGIN CATCH  
      SET @ResponseCode=-999  
  END CATCH       
 END  

 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  


6:02 AM Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top