如何将特定的列转换为十进制 [英] how to cast the particular column to decimal

查看:56
本文介绍了如何将特定的列转换为十进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT 'IATA' AS 'MODULE',(SELECT * from [DBO].[FormatIndianCurrency](cast(ISNULL(SUM(AMOUNT)*-1,00)) as decimal(19,2))) AS 'AMOUNT'  FROM TABLE NAME



我无法将此金额列转换为十进制.当我执行该列时显示错误-



I''m not able to cast this amount column to decimal.when i execute it is showing an error--

Incorrect syntax near ''cast'', expected ''AS''.

您能否建议我任何解决方案

can u please suggest me any solution

推荐答案

SELECT 'IATA' AS 'MODULE',(SELECT (cast(ISNULL(SUM(AMOUNT)*-1,00)) as decimal(19,2))) AS 'AMOUNT' from [DBO].[FormatIndianCurrency])  FROM TABLE NAME



您应该在SELECT语句中编写该操作.



You should write that operations in SELECT statement.


看起来第3行的括号中有不匹配项.您需要修复第3行才能解决该错误.

Looks like there is a mismatch in the parenthesis at line 3. You need to fix 3rd line to resolve the bug.

SELECT 
'IATA' AS 'MODULE',
(SELECT * from [DBO].[FormatIndianCurrency]
(cast(ISNULL(SUM(AMOUNT)*-1,00)) as decimal(19,2))) AS 'AMOUNT'  
FROM TABLE NAME


Hello不匹配括号位于演员表,请使用它,
Hello mismatch parenthesis in cast so use it,
SELECT 'IATA' AS 'MODULE',(SELECT * from [DBO].[FormatIndianCurrency](cast(ISNULL(SUM(AMOUNT)*-1,00) as decimal(19,2)))) AS 'AMOUNT'  FROM TABLE NAME


这篇关于如何将特定的列转换为十进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆