Collections:
Creating Stored Procedures with Parameters in SQL Server
How To Create Stored Procedures with Parameters in SQL Server Transact-SQL?
✍: FYIcenter.com
Very often, you need to create a stored procedure with one or more parameters. You only supply values to those parameters at the time of executing the stored procedure.
Stored procedures with parameters can be created with the following syntax:
CREATE PROCEDURE procedure_name @parameter_1 datatype, @parameter_2 datatype, ... @parameter_n datatype AS statement_1; statement_2; ... statement_n; GO
The following tutorial exercise shows you how to create a stored procedure with one parameter called @url:
USE FyiCenterData; GO DROP PROCEDURE Hello; GO CREATE PROCEDURE Hello @url nvarchar(40) AS PRINT 'Welcome to ' + @url; GO EXEC Hello 'dba.fyicenter.com'; GO Welcome to dba.fyicenter.com
2017-01-05, 752👍, 0💬
Popular Posts:
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
Where to find answers to frequently asked questions on SQL Transaction Management in Oracle? Here is...
How To Create a Stored Function in Oracle? A stored function is a function with a specified name and...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...