Return multiple result sets from stored procedure sql server
- two select statements in one stored procedure
- multiple selects in one stored procedure
- multiple select statements in stored procedure
- can we write multiple select statements in stored procedure
Stored procedure returning multiple result sets c.
How to write SELECT Stored Procedure in SQL Server?.
Sql select from stored procedure
Or How to write the SELECT Statements inside the Stored Procedure with example. For this SELECT Stored Procedure demonstration, we use the below-shown data.
SELECT Stored Procedure in SQL Server Example
In this SQL Server example, we will show you how to use the SELECT Statement inside the Stored procedure.
I suggest you refer Introduction to Stored Procedures article to know the basics.
-- Example for SELECT Statement Inside the SQL Stored Procedure IF OBJECT_ID ( 'SelectStoredProcedureFirstExample', 'P' ) IS NOT NULL DROP PROCEDURE SelectStoredProcedureFirstExample; GO CREATE PROCEDURE SelectStoredProcedureFirstExample AS BEGIN SET NOCOUNT ON; SELECT [FirstName] + ' ' + [LastName] AS [Full Name] ,[Education] ,[Occupation] ,[YearlyIncome] ,[Sales] ,[HireDate] FROM [Employee] END GOFrom the above code snippet, you can see that we are concatenating the First name and second name as Full Name.
We are using the SPACE function to provide the space between the First name and last name
Let me use the EXEC Command (Execute Comm
- 2 select statements in stored procedure