Collections:
Creating Stored Procedures with Statement Blocks in SQL Server
How To Create a Stored Procedure with a Statement Block in SQL Server Transact-SQL?
✍: FYIcenter.com
If you are creating a stored procedure with multiple statements, it's better to use "BEGIN ... END" to group all statements into a single statement block.
The tutorial exercise below shows you some good examples:
USE FyiCenterData; GO CREATE PROCEDURE Show AS BEGIN SELECT name, type_desc FROM sys.tables; SELECT name, type_desc FROM sys.views; SELECT name, type_desc FROM sys.procedures; END; GO Command(s) completed successfully. EXEC Show; GO name type_desc ------------------- --------------------- fyi_random USER_TABLE fyi_links_indexed USER_TABLE fyi_links USER_TABLE fyi_links_copy USER_TABLE name type_desc ------------------- --------------------- fyi_links_top VIEW fyi_links_dump VIEW fyi_links_view VIEW name type_desc ------------------- --------------------- Hello SQL_STORED_PROCEDURE date SQL_STORED_PROCEDURE Show SQL_STORED_PROCEDURE
2017-01-05, 833👍, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Oracle Database 10g Express Edition? I want t...
How To Create a Test Table for Transaction Testing in Oracle? If you want to practice DML statements...
What is mscorsvw.exe - Process - Microsoft .NET Framework NGEN in SQL Server? Process mscorsvw.exe i...
How To Create a Table in a Specific Tablespace in Oracle? After you have created a new tablespace, y...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...