Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SP input parameters default values

Author  Topic 

OwnedByTheMan
Starting Member

35 Posts

Posted - 2002-01-15 : 22:30:17
create procedure test @var1 varchar(25) = NULL,
@var2 varchar(25) = NULL,
@var3 varchar(25) = NULL

Calling this from an ASP page, I might create a statement like this:

Exec test 'Variable1', '', Variable3'
(I am building a web search using a dynamic "where" and I have reviewed all the dymnamic sql articles. None of them answer this question.)

Now, using the above, the second var (@var2), doesn't resolve to NULL. How do I submit no value to a SP and have it assume its default value?

Exec test 'Variable1',,'Variable2' gives me an error in QA.

I assume that I am just missing something obvious.

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2002-01-15 : 22:41:07
OwnedByTheMan,

Name the parameters

eg.


exec test @var1='Variable1', @var3='Variable3'


DavidM

Tomorrow is the same day as Today was the day before.
Go to Top of Page

OwnedByTheMan
Starting Member

35 Posts

Posted - 2002-01-16 : 11:17:29
Of course... I knew it must be stupidly simply. Thanks for the pointer.

Go to Top of Page
   

- Advertisement -