Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
select cast(B1 as int)+(cast(H1 as int)+(cast(C1 as int)+(cast(I1 as int)) as [man] From Kanpur


B1, H1, C1, I1 is declared as nvarchar in database
Posted
Updated 28-Apr-14 2:05am
v3

1 solution

Too many left parenthesis.

select cast(B1 as int)+cast(H1 as int)+cast(C1 as int)+cast(I1 as int) as [man] From Kanpur 


B1, H1, C1, I1 should be declared in the database as INT data type columns. Then you would not have to use the CAST function. It is an unprofessional programming practice to store data in a database in a column that does not represent the type of data stored. INTs should be stored in INT data type. Dates should be stored in Date data types.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900