store procedure in sql
A stored procedure is a set of Structured Query Language (SQL) statements with an assigned name, which are stored in a relational database management system as a group, so it can be reused and shared by multiple programs.
Example :
Create store procedure to fetch country details by passing to argument city and Country
CREATE PROCEDURE [dbo].[GetCustomerData]
@city nvarchar(max),
@country nvarchar(max)
AS
Select * from Customers
where
City like '%'+ @city +'%' or
Country like '%'+ @country +'%'
Example :
Create store procedure to fetch country details by passing to argument city and Country
CREATE PROCEDURE [dbo].[GetCustomerData]
@city nvarchar(max),
@country nvarchar(max)
AS
Select * from Customers
where
City like '%'+ @city +'%' or
Country like '%'+ @country +'%'

No comments