Skip to main content

Posts

Showing posts with the label Create stored procedure to show employee details as per filtered range in sql

Create stored procedure to show employee details as per filtered range in sql

This is nice example of Stored procedure . You can get Idea that how to Create stored procedure to get employee details as per filtered parameter range of sql. To become SQL Expert we should required to expert in Stored procedure and parameter terms. SET ANSI_NULLS ON Go SET QUOTED_IDENTIFIER ON Go CREATE PROCEDURE spx_GetEMploye @Filter VARCHAR(50) AS BEGIN SET NOCOUNT ON; IF @Filter = 'ALL' SELECT ContactName, City, Country, PostalCode FROM Employee ELSE IF @Filter = '10' SELECT TOP 10 ContactName, City, Country, PostalCode FROM Employee ELSE SELECT ContactName, City, Country, PostalCode FROM Employee WHERE mailto:Country=@Filter END GO