How To Create a Simple Stored Procedure in MS SQL Server?
Submitted by: AdministratorIf you want to create a simple stored procedure with no input and output parameters, you can use the "CREATE PROCEDURE" command with a statement batch in a simple format as shown in below:
</pre>CREATE PROCEDURE procedure_name AS
statement_1;
statement_2;
...
statement_n;
GO
The following tutorial exercise shows you how to create a simple stored procedure:
USE GlobalGuideLineDatabase;
GO
CREATE PROCEDURE Hello AS
SELECT 'Welcome to:';
SELECT ' GlobalGuideLine.com';
GO
Command(s) completed successfully.
EXEC Hello;
GO
-----------
Welcome to;
(1 row(s) affected)
----------------
GlobalGuideLine.com
(1 row(s) affected)</pre>
Submitted by: Administrator
</pre>CREATE PROCEDURE procedure_name AS
statement_1;
statement_2;
...
statement_n;
GO
The following tutorial exercise shows you how to create a simple stored procedure:
USE GlobalGuideLineDatabase;
GO
CREATE PROCEDURE Hello AS
SELECT 'Welcome to:';
SELECT ' GlobalGuideLine.com';
GO
Command(s) completed successfully.
EXEC Hello;
GO
-----------
Welcome to;
(1 row(s) affected)
----------------
GlobalGuideLine.com
(1 row(s) affected)</pre>
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Select Some Specific Rows from a Table in MS SQL Server? |
☺ | What Happens If You Insert a Duplicate Key for the Primary Key Column in MS SQL Server? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How to Create a View using Data from Another View? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |