As the topic suggests I wish to be able to pass Table Names as Parameters using .Net (doesn't matter which language really) and SQL.
I Know how to do this for values, i.e command.Parameters.AddWithValue("whatever",whatever). Using @whatever in the query to denote the Parameter. The thing is I am in a situation where I wish to be able to do this with other parts of the query such as Field and Tablesnames.
This is not an ideal situation but it's one I have to use, It's not really prone to SQL Injection as only someone using the code can set these table names and not the end-user. It is messy however,
So, is what I am asking possible?
EDIT: To make the point about SQL Injection clear, the Table Names are only passed in by source code, depending on the situation. It is the developer who specifies this. The developer will have access to the Database layer anyway, so the reason I am asking is not so much for security but just to make the code cleaner.