Sergey Alekseevich wrote:
SET @s = ' SET @cn = (SELECT Count (' + COL_NAME (OBJECT_ID (' Result '), @sch) + ') FROM Result WHERE Id_s = ' + @id_s + ' and ' + COL_NAME (OBJECT_ID (' Result '), @sch) +>>> ' between ' + @min + ' and ' + @max + ') ' <<< execute sp_executesql @s, N ' @cn int output ', @cn out
, cunningly, I try to compare column name with
Then other question: How to pull out value of a column, knowing his name in such format "COL_NAME (OBJECT_ID (' Result '), @sch)"?
I do not use Cost (*) simply for check of operation of construction Col_name. If with where I will understand, I will pass on cost (*)