Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
SQL
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
Posted
Comments
Ganesan Senthilvel 25-Jun-12 7:08am    
It is not a good practice to write the description in CAPITAL letters.

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


You should write that operations in SELECT statement.
 
Share this answer
 
v2
Looks like there is a mismatch in the parenthesis at line 3. You need to fix 3rd line to resolve the bug.

SQL
SELECT 
'IATA' AS 'MODULE',
(SELECT * from [DBO].[FormatIndianCurrency]
(cast(ISNULL(SUM(AMOUNT)*-1,00)) as decimal(19,2))) AS 'AMOUNT'  
FROM TABLE NAME
 
Share this answer
 
Hello mismatch parenthesis in cast so use it,
SQL
SELECT 'IATA' AS 'MODULE',(SELECT * from [DBO].[FormatIndianCurrency](cast(ISNULL(SUM(AMOUNT)*-1,00) as decimal(19,2)))) AS 'AMOUNT'  FROM TABLE NAME
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900