SidTheSquid
Programmer
Hi, I have the following stored procedure:
CREATE PROCEDURE spSelectGroupCount
@ColName varchar(20)
AS
Select @ColName, count(1) From traffic_log group by @ColName
All I want was to pass in a column name and it counts number of times a hit was found for a particular entry. I am getting the syntax error
"Error 164: Group BY expression must refer to a column name that appear in the select list"
I dont understand why i get this error. Anybody care to explain and give me some sql guidance
Sid
CREATE PROCEDURE spSelectGroupCount
@ColName varchar(20)
AS
Select @ColName, count(1) From traffic_log group by @ColName
All I want was to pass in a column name and it counts number of times a hit was found for a particular entry. I am getting the syntax error
"Error 164: Group BY expression must refer to a column name that appear in the select list"
I dont understand why i get this error. Anybody care to explain and give me some sql guidance
Sid