3 ms·
You can combine literals into an SQL query, and doing so isn't even hard to do correctly. You'd still use parameters to feed user input, of course.
by namibj 5y ago
You can combine literals into an SQL query, and doing so isn't even hard to do correctly. You'd still use parameters to feed user input, of course.
- DaiPlusPlus 5y agoSQL Server has had _autoparameterization_ opf queries for a while now: when you have multiple queries of the same general shape but with varying literal values, it automatically converts the literals to parameters (rather than vice-versa), and it's generally beneficial for performance because existing query-plans can be reused (instead of having to create a new plan for each literal value encountered): https://www.mssqltips.com/sqlservertip/2935/sql-server-simple-and-forced-parameterization/ https://www.mssqltips.com/sqlservertip/2935/sql-server-simpl...
- namibj 5y agoI didn't mean it that way. I mean you can combine SQL fragments, think multiple `ORDER BY` clauses.