Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BO.CreateParameter and null
Message
 
 
To
25/05/2010 16:31:42
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01465928
Message ID:
01465975
Views:
35
>>Frank,
>>
>>One thing you could do is just add a default value in your stored procedure that will be used in the occurence of no value being passed to the stored procedure. Then the stored procedure will still run even if you do not pass a paramter value for one that has a default
>>
>>Here is an example:
>>
>>
>>CREATE PROCEDURE [dbo].[ClientSelectByDynamic]
>>	@ClientNumber int = 0, @ClientName char(20) = '   ', @PolicyNumber char(20) = '  '
>>
>>AS ...
>>
>>
>>I have never passed null as a parameter, but you could very easily pass something else (like a blank) and do what you want based on this input.
>>
>Thanks Bob,
>
>in the meantime I had changed the stored procedure to test for blanks instead of nulls and that works, but I feel nulls make a bit more sense. I'll see if the default values will help.
>
>FWIW this is the article that I am trying to understand and implement the technique from:
>
>http://www.sqlservercentral.com/articles/Dynamic+SQL/70109/

Yes, it's a good article. Take also a look at this blog on this exact topic - may be even easier to understand
http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/do-you-use-column-param-or-param-is-null
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform