Guest User

Untitled

a guest
Jan 16th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //TODO : verify (whitelist) that @operator is in a known set of values...
  2. // '=', '<>', '>', '<' etc - otherwise security risk
  3. declare @sql varchar(4000) = 'select * from Foo where Bar '
  4. + @operator + ' @value'
  5. exec sp_executesql @sql, N'@value int', @value
  6.  
  7. //TODO : verify (whitelist) that @operator is in a known set of values...
  8. // '=', '<>', '>', '<' etc - otherwise security risk
  9. declare @sql varchar(4000) = 'select * from Foo where Bar '
  10. + @operator + ' @p'
  11. exec sp_executesql @sql, N'@p int', @value
Add Comment
Please, Sign In to add comment