MyITBlog.com - IT Professionals Online Journal
 
  Home  |   Site News  |   About Us  |   Privacy  |   FAQ  |   Contact   Add Blog Entry  |  Login  |  Register   
 My Account
Username
Password
Remember me
Lost Password?


 Categories


  HOME  >  Programming  >  DatabasePrint


0
Votes
Passing Optional Parameters to a Stored Procedure in Database   
by Thivya on 06 Mar 2006, 09:30     Read Thivya's Blog
Total Hits: 2191    Comments: 0   

To pass a optional parameters to a stored procedure in SQL Server, declare the parameter with the default value.

Create Procedure proc_Test

@a int,

@b int =5 -- Provided with the default value.

as

begin

       Select @a, @b

end

Note:

When using optional parameters at first, specify it with the parameter name during execution

For example, if @a is an optional parameter, to execute this stored proecedure, specify it as follows 

EXEC proc_Test @b=3

 


 

Post Comment

Copyright © 2008 MyITBlog.com