Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Credit Limit Not Null and In Range
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01375287
Message ID:
01375322
Vues:
15
>I want to pull records in a proc.
>
>If both @CreditLimitMin and @CreditLimitMax were passed, then it should pull records with limits in between both
>If @CreditLimitMin was passed and @CreditLimitMax was not, then it should pull records a limit equal to or above it
>If @CreditLimitMax was passed and @CreditLimitMin was not, then it should pull records a limit equal to or below it
>
>
>Here's what I have so far
>
>
>

See my changes inside.

>SELECT * 
>	FROM Customers
>	WHERE RecordId = ISNULL(@RecordId, RecordId) AND
>		  FirstName = ISNULL(@FirstName, FirstName) AND
>		  LastName = ISNULL(@LastName, LastName) AND (@CreditLimitMin IS NULL OR Limit>=@CreditLimitMin)
>		  AND (@CreditLimitMax IS NULL or LIMIT <=@CreditLimitMax) AND
>		  State = ISNULL(@State, State) AND
>		  Active = ISNULL(@Active, Active)
>
>
>
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform