Reputation: 11
Below is the query I am trying to run using Microsoft SQL Server Management Studio:
update [SG report]
set [percentage_paid] = ([Savings This Season (All)] / [Savings Goal Amount]) * 100
Upvotes: 0
Views: 1367
Reputation: 1270463
One or both of your values are strings. Use try_convert()
to convert them to an appropriate type. The specific type is not clear, but something like:
update [SG report]
set [percentage_paid] = (try_convert(float, [Savings This Season (All)]) * 100 /
try_convert(float, [Savings Goal Amount])
);
Upvotes: 1
Reputation: 824
update [SG report]
set [percentage_paid] = ([Savings This Season (All)] / [Savings Goal Amount]) * 100
where isnumeric([Savings This Season (All)])=1 and isnumeric([Savings Goal Amount])=1
Upvotes: 0