For my SQL queries, I usually do the following for SELECT statements:
SELECT ...
FROM table t
WHERE 1=1
AND t.[column1] = @param1
AND t.[column2] = @para
No, SQL Server is smart enough to omit this condition from the execution plan since it's always TRUE
.
Same is true for Oracle, MySQL and PostgreSQL.
No performance hit. Even if your WHERE clause is loaded with a large number of comparisons, this is tiny.
Best case scenario is that it's a bit-for-bit comparison. Worse case is that the digits are evaluated as integers.