Skip to content

Instantly share code, notes, and snippets.

@k-maru
Created March 5, 2016 11:01
Show Gist options
  • Save k-maru/30e7587f6bde7d4900b6 to your computer and use it in GitHub Desktop.
Save k-maru/30e7587f6bde7d4900b6 to your computer and use it in GitHub Desktop.
from and to parameter range sql
(
1 = CASE WHEN :ValueFrom /*Number*/ IS NULL THEN 1
WHEN ColumnName >= :ValueFrom/*Number*/ THEN 1
ELSE NULL END
AND
1 = CASE WHEN :ValueTo/*Number*/ IS NULL THEN 1
WHEN ColumnName <= :ValueTo/*Number*/ THEN 1
ELSE NULL END
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment