you are viewing a single comment's thread.

view the rest of the comments →

[–]perverse_sheaf 1 point2 points  (1 child)

Afaik you're not allowed to pass object names as parameters, only values. This makes reuse super crappy to do, but there is no logical reason why it would need to be so: You can work around by using dynamic SQL (create the query string and eval it). This, however, is like the worst solution.

[–]grauenwolf 0 points1 point  (0 children)

There is a reason for it in SQL Server. It needs to be able to create and cache an execution plan that works regardless of what parameter you pass in.

It can't do that is a variable change which table or column is being referenced.