dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jun 20, 2000

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Passing a Parameter to a Stored Procedure

Question:
How do you pass a parameter to a stored procedure from within another stored procedure?

Answer:
To call a stored procedure from inside another stored procedure, let's take an example of a procedure that returns information for all the tables in a database or for a single table. The following stored procedure calls the sp_tables system stored procedure using the EXECUTE statement and takes either no parameters or the name of a table:

CREATE PROCEDURE ListTables
  @TableName varchar(255)=NULL
 AS
  SET NOCOUNT ON
  EXEC sp_tables @TableName

  RETURN 0
GO
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date