下面是我尝试使用microsoft sql server management studio运行的查询:
update [SG report] set [percentage_paid] = ([Savings This Season (All)] / [Savings Goal Amount]) * 100
7ivaypg91#
一个或两个值都是字符串。使用 try_convert() 将它们转换为适当的类型。具体的类型不清楚,但类似于:
try_convert()
update [SG report] set [percentage_paid] = (try_convert(float, [Savings This Season (All)]) * 100 / try_convert(float, [Savings Goal Amount]) );
mpbci0fu2#
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
2条答案
按热度按时间7ivaypg91#
一个或两个值都是字符串。使用
try_convert()
将它们转换为适当的类型。具体的类型不清楚,但类似于:mpbci0fu2#