Quantcast
Channel: Programmer's Town - Count of lines in dynamic request
Viewing all articles
Browse latest Browse all 8

Re: Count of lines in dynamic request

$
0
0
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 (*)


Viewing all articles
Browse latest Browse all 8

Trending Articles