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)
 passing a null parameter to a stored procedure with ado

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-30 : 08:41:00
Catalin writes "Hello!

If have a stored procedure with some parameter, how acn i pass a null parameter in the parameters collection?

The sql syntax will be: exec MyProc @Param1_in = null @Param2_in = 'some string'

Thanks!"

Nazim
A custom title

1408 Posts

Posted - 2002-01-30 : 09:08:59
Firstly, you can set the defaul value as null omit the passing of the parameter which will be taken as null

create procedure ak( @m int =null)
as
select @m

exec ak -- will take @m as null

secondly,
by your normal call exec MyProc null,'ads'

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-01-30 : 12:43:18
You can create the parameter as normal and set it's value to null.
If it is a string parameter then you will need to set the length to 1.



==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -