Check if parameter supplied to SP inside SP 
Author Message
 Check if parameter supplied to SP inside SP

Is it possible to see if a parameter is supplied (or NOT NULL) to a stored
procedure, and if it is perform an update, and if it isn't perform and
insert? SQL Server complains that an expected parameter was not supplied.
See an example of what I'm trying to do.
thanks
matt



 begin
  insert into Project (blah, blah)
  values (blah, blah)
 end
else
 begin
  update Project SET blah=blah, etc.

 end
GO



Sun, 11 Apr 2004 15:15:42 GMT
 Check if parameter supplied to SP inside SP


and an integer for update, but I'm not completely happy with that.
Any better suggestions?
thanks
--
Matt
www.psaproject.com.au
Don't PARTY when replying by direct email
Quote:
> Is it possible to see if a parameter is supplied (or NOT NULL) to a stored
> procedure, and if it is perform an update, and if it isn't perform and
> insert? SQL Server complains that an expected parameter was not supplied.
> See an example of what I'm trying to do.
> thanks
> matt

> CREATE procedure [ProjInsert]








Sun, 11 Apr 2004 15:36:27 GMT
 Check if parameter supplied to SP inside SP
Hello

| Is it possible to see if a parameter is supplied (or NOT NULL) to a stored
| procedure, and if it is perform an update, and if it isn't perform and
| insert? SQL Server complains that an expected parameter was not supplied.

Change definition from:

To:

In this way you set default value for parameter.

Rgds,

--
Waldemar Thiel

*** There are no mistakes, just learning experience ***



Sun, 11 Apr 2004 15:24:47 GMT
 Check if parameter supplied to SP inside SP
Doh! Thanks Waldemar - that's good.

provide either an 'i', 'u' or 'd' for insert update delete. The advantage of
this is that I can use the one ASP web page and one stored procedure to
either do an insert, update or delete. Hopefully this will cut the
production time of my forms by up to 2/3s!
--
Matt
www.psaproject.com.au
Don't PARTY when replying by direct email

Quote:
> Hello

> | Is it possible to see if a parameter is supplied (or NOT NULL) to a
stored
> | procedure, and if it is perform an update, and if it isn't perform and
> | insert? SQL Server complains that an expected parameter was not
supplied.

> Change definition from:


> To:


> In this way you set default value for parameter.

> Rgds,

> --
> Waldemar Thiel

> *** There are no mistakes, just learning experience ***



Mon, 12 Apr 2004 07:54:01 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. sp inside sp

2. Using a SP inside another SP

3. Calling SP from inside another SP

4. How can I call a SP inside a SP without the owner name

5. Use a sp to Make a view with a sp inside

6. calling SP inside SP

7. How Get Output Param from Inside SP, calling another SP

8. Passing BCP Commandline parameters inside a SP

9. SP:ExecContextHit,SP:CacheMiss,SP:CacheInsert

10. Optional Parameters to SP - no value, one, or several values per parameter

11. Oracle SP Parameter Error - Invalid Parameter Type

12. calling a stored procedure inside another sp


 
Powered by phpBB® Forum Software