|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Retrieving Column Name
Hello
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 FROM Employee_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. Mythri |
|
#2
|
|||
|
|||
|
does the query run outside of the application?
another way of setting the column name is SELECT 'Emp_csh_cash' = Sum(Emp_Csh_Cash) |
|
#3
|
|||
|
|||
|
Yes the query works outside the application. Anyway thanks, I will try out this way too.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Retrieving Column Name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|