?
Solved

Set Optional to the Parameters in Sproc

Posted on 2002-04-25
2
Medium Priority
?
342 Views
Last Modified: 2008-03-03
I would like to know whether we can set the parameter in Sproc to be an optional. The values that passed from VB or Access to the sproc can be ignore when this option has been set. Like in Vb or VBA, the function that we create or declare can define the variables either optional or compulsory. Does anyone know this?????

0
Comment
Question by:jetyun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 6968005
CREATE PROC yourproc
  @mandatory varchar(10),
  @optional int = NULL
AS
  SELECT @mandatory, @optional
GO

try usage:
EXEC yourproc 'testing', 10
EXEC yourproc 'testing'
EXEC yourproc ----> error, proc expects value for parameter @mandatory

CHeers
0
 

Author Comment

by:jetyun
ID: 6968040
cool ..i got it..thankx
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question