The MS SQL Server Stored system is utilized to save time to compose code over and over by putting away the equivalent in data set and furthermore get the necessary yield by passing boundaries.
Syntax
Following is the essential sentence structure of Stored strategy creation.
Create procedure <procedure_Name>
As
Begin
<SQL Statement>
End
Go
Example
Consider the CUSTOMERS table having the accompanying records.
ID NAME AGE ADDRESS SALARY
1 Ramesh 32 Ahmedabad 2000.00
2 Khilan 25 Delhi 1500.00
3 kaushik 23 Kota 2000.00
4 Chaitali 25 Mumbai 6500.00
5 Hardik 27 Bhopal 8500.00
6 Komal 22 MP 4500.00
7 Muffy 24 Indore 10000.00
Following order is a model which would get all records from the CUSTOMERS table in Testdb data set.
CREATE PROCEDURE SelectCustomerstabledata
AS
SELECT * FROM Testdb.Customers
GO
The above order will deliver the accompanying yield.
ID NAME AGE ADDRESS SALARY
1 Ramesh 32 Ahmedabad 2000.00
2 Khilan 25 Delhi 1500.00
3 kaushik 23 Kota 2000.00
4 Chaitali 25 Mumbai 6500.00
5 Hardik 27 Bhopal 8500.00
6 Komal 22 MP 4500.00
7 Muffy 24 Indore 10000.00