sqldba2013
asked on
SQL query error+SQL Server
Hi All,
Please suggest how to fix below error.
Error:
Msg 8117, Level 16, State 1, Procedure Employee_vw, Line 3
Operand data type bit is invalid for sum operator.
Msg 4413, Level 16, State 1, Line 8
Could not use view or function 'Employee_vw' because of binding errors.
Please suggest how to fix below error.
Error:
Msg 8117, Level 16, State 1, Procedure Employee_vw, Line 3
Operand data type bit is invalid for sum operator.
Msg 4413, Level 16, State 1, Line 8
Could not use view or function 'Employee_vw' because of binding errors.
select
concat(year,'-',(select left(datename(month,dateadd(month, month , -1)),3))) [Date],
sum(amount) [amount],
sum
(
[Met]
)
[Order] from Employee_vw
group by year,month
order by year,month
View structure:
Year int
Month int
[Met] decimal
[amount] int
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Met data type is decimal not bit.
View structure:
Year int
Month int
[Met] decimal
[amount] int
View structure:
Year int
Month int
[Met] decimal
[amount] int
the issue is defintively then in the view Employee_vw, please post that full query
select concat(year,'-', left(datename(month,dateadd(month, month , -1)),3) ) [Date]
, sum(amount) [amount]
, sum([Met]) [Order]
from Employee_vw
group by year,month
order by year,month
ASKER
Thanks for your inputs. I have resolved my issue myself by modifying query.
ASKER