Reputation: 10805
What does this statement meaning, could somebody elaborate me on this please
(@diplomaPercentage is null OR diploma_percentage>=@diplomaPercentage)
Upvotes: 0
Views: 96
Reputation: 6277
This kind of condition is usually used to avoid "dynamic SQL", but it makes the code ugly and ironically may result in worse performance compared to just using dynamic SQL. You can read more about this at:
http://www.sommarskog.se/dyn-search-2005.html
Upvotes: 2
Reputation: 135011
If no value for @diplomaPercentage is passed it it will return all rows, otherwise it will return all the rows where diploma_percentage is greater than @diplomaPercentage if a value has been passed in
Upvotes: 1
Reputation: 218847
If you give it a null value for @diplomapercentage
then it will return all records, otherwise it will it return only the records with a diploma_percentage
value greater than or equal to the one you supply.
Upvotes: 1
Reputation: 55489
@diplomaPercentage is a variable.
@diplomaPercentage is null is checking if the variable is NULL or not and
diploma_percentage>=@diplomaPercentage is checking if the column value diploma_percentage is greater than or equal to variable value
Upvotes: 1
Reputation: 25370
Will be returned all rows if diplomaPercentage is not specified (i.e. passed null), in other cases will be returned rows where diploma_percentage more or equal @diplomaPercentage. :)
Upvotes: 2