Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created April 28, 2015 22:43
Show Gist options
  • Select an option

  • Save dnasca/8458b26121ce6b7ff4a2 to your computer and use it in GitHub Desktop.

Select an option

Save dnasca/8458b26121ce6b7ff4a2 to your computer and use it in GitHub Desktop.
exec ('
SELECT DISTINCT ' +
@SearchField + ' FROM SchemaAudit WHERE StartDate >= "'
+ CAST(@DateFrom as varchar(20))
+ '" AND EndDate >= "'
+ CAST(@DateTo as varchar(20))
+ '"
ORDER BY ' + @SearchField +' ASC')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment