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)
 regarding passing parameters in storedprocedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-18 : 08:26:48
sunitha writes "Hi,

I created a stored procedure... In that procedure i need to pass 5 parameters which are dynamic values...the condition is if pass one parameter with space and all other have values , i tried this by giving an if condition in the beginnig,
ie,
If @value = ''
select @value ='%'
but this is not retrieving any records even if the records are there . Its very urgent .... Please help me..."

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-18 : 10:17:21
to do it like that you need to use a like in the select

where value like @value

Are you sure it is being passed as '' rather than null? Try looking at the call using the profiler or logging to param,eters to a table in the sp.

Another way is
where (value = @value or @value = '')

or for nulls
where (value = @value or @value is null)
where coalesce(@value,value) = value

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -