UnsolvedCoding
Technical User
I am working on getting the values of variables from a select statment that is in a stored procedure. The problem I am getting is that the select statment has two specific variables that use a count to return values.
The first one - @Upload_Count will not function with or without a select statment. It doesn't matter if it reads (Select count(*) or a straight from C_Comment because I keep getting an error message that says "Incorrect syntax near the keyword 'From'."
The second one - @Blank_Count, runs just fine with a select statment but I can't get it to accept an alias regardless of its location.
Two questions -
1) Why is there a difference?
2) Why can't I asign a column name to the variable?
Here is the select portion of the code
Select @Multi_Counter as Multi_Count,
@Multi_Fixed_Counter as Multi_Fixed,
@Posted_By_Counter as Posted,
@Blank_CB_Count as Blank,
@Upload_Count =(From C_Comment
Where Switch = 0), -- as Uploaded
@Blank_Count = (Select count(*) from C_Comment
where Nbr ='') -- as Blank
The first one - @Upload_Count will not function with or without a select statment. It doesn't matter if it reads (Select count(*) or a straight from C_Comment because I keep getting an error message that says "Incorrect syntax near the keyword 'From'."
The second one - @Blank_Count, runs just fine with a select statment but I can't get it to accept an alias regardless of its location.
Two questions -
1) Why is there a difference?
2) Why can't I asign a column name to the variable?
Here is the select portion of the code
Select @Multi_Counter as Multi_Count,
@Multi_Fixed_Counter as Multi_Fixed,
@Posted_By_Counter as Posted,
@Blank_CB_Count as Blank,
@Upload_Count =(From C_Comment
Where Switch = 0), -- as Uploaded
@Blank_Count = (Select count(*) from C_Comment
where Nbr ='') -- as Blank