Skip to content

Instantly share code, notes, and snippets.

@FembotDBA
Last active August 29, 2015 14:20
Show Gist options
  • Save FembotDBA/8b1c9a66402da609983c to your computer and use it in GitHub Desktop.
Save FembotDBA/8b1c9a66402da609983c to your computer and use it in GitHub Desktop.
Generic Query Not SARGable
SELECT a.column1
, a.column2
, a.column3
, a.timePeriod
, a.column5
FROM schema.tablea a
LEFT JOIN schema.tableb AS b ON a.column2 = b.column1
LEFT JOIN schema.tablec AS c ON b.column2 = c.column1
WHERE CONVERT(VARCHAR(8),a.TimePeriod,112) >= @DateParameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment