Why was this T-SQL Syntax never implemented?
- by ChrisA
Why did they never let us do this sort of thing:
Create Proc RunParameterisedSelect
@tableName varchar(100),
@columnName varchar(100),
@value varchar(100)
as
select * from @tableName
where @columnName = @value
You can use @value as a parameter, obviously, and you can achieve the whole thing with dynamic SQL, but creating it is invariably a pain.
So why didn't they make it part of the language in some way, rather than forcing you to EXEC(@sql)?