November 18th, 2003, 12:21 AM
Retrieving Column Name
I am using Sql Server and VC++. In VC++ I am using the below mentioned Query in my application to retrieve the sum of a particular column from a particular table.
But I am not able to retrieve that column namer on which I have set the Sum function. The application returns a run time error saying abnormal termination of the program.
The query is as below,
SELECT Sum(Emp_Csh_Cash) as Emp_csh_cash
WHERE Emp_Csh_Empdid in (Select Emp_ID from Employee where Emp_typ_Slno <> 3 and emp_typ_slno <> 4 )
I have tried giving all possible combination of column names such as Emp_csh_cash, "Emp_csh_cash", Sum(Emp_csh_cash).
But all have returned a run time error as mentioned above.
Can anyone tell me as to what is wrong in my query or how else should I specify the name.
November 18th, 2003, 10:43 AM
does the query run outside of the application?
another way of setting the column name is
SELECT 'Emp_csh_cash' = Sum(Emp_Csh_Cash)
November 18th, 2003, 10:49 PM
Yes the query works outside the application. Anyway thanks, I will try out this way too.