Given a string '100+200', how do I evaluate it?
'100+200'
I want to get 300 on output.
300
DECLARE @expression VARCHAR(MAX) = '100+200' EXEC (N'SELECT ' + @expression)
If it comes from a user, make sure it's sanitized
2.1m questions
2.1m answers
60 comments
57.0k users