When writing TSQL stored procedures I find myself wanting to centralize / normalize some parts of the code. For example, if I have a query like this:
SELECT * FROM SomeTable WHERE SomeColumn IN (2, 4, 8)
For cases like this I would like to put (2,4,8) in some place outside of the procedure that I could reuse in some other query later -- to avoid repetition. Is there a built-in way to do this? What would really neat is if I could break apart entire pieces of SQL code, like parts of the WHERE clause, and reuse those in other queries, but I doubt this is possible.
Thanks.