SQL .NET
asked on
how to use aggregate function or nvarchar( or whats the workaround?)
I have a column with score of test. The datatype is set to nvarchar. Now I have to create a report from the table which includes avg of specific range of records. I cant use the avg function on the column. Please help. Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can you please help with the use of convert function.
>>"Can you please help with the use of convert function."
what help do you need?
AVG(CAST(score as int))
AVG(CAST(score as decimal(6,2)))
what help do you need?
AVG(CAST(score as int))
AVG(CAST(score as decimal(6,2)))
ASKER
I have tried the cast but it gives error because it has decimal values too. And gives this error:Conversion failed when converting the nvarchar value '61.60' to data type int.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
ASKER