Solved

convert function help plese

Posted on 2009-05-06
3
254 Views
Last Modified: 2012-05-06
I am trying to use this function and it is throwing error, i tried it two different ways but getting two different errors, any ideas...

First:
 
Cast(CAST(e.currentintrate as varchar(20))* CAST(e.currentprinbal as varchar(20)) * (30))/((360)*(100))) as VARCHAR(50)) as AINTINC,
Msg 1035, Level 15, State 10, Line 22 
Incorrect syntax near 'Cast', expected 'AS'.
 
Second:
 
convert(varchar, Cast((AINTRATE*AAVGBALA*(30))/((360)*(100)) as  money)) as AINTINC,
 
Msg 8117, Level 16, State 1, Line 9
Operand data type varchar is invalid for multiply operator.

Open in new window

0
Comment
Question by:fahVB
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 24318915
what about this:
convert(varchar(30), Cast( ( cast( AINTRATE as decimal(20,4)) * cast(AAVGBALA as decimal(20,4)) * 30)/(360*100) as  money)) as AINTINC,

Open in new window

0
 

Author Comment

by:fahVB
ID: 24318918
currentbalance      smallmoney
currentintrate      varchar(6)      
0
 

Author Closing Comment

by:fahVB
ID: 31578692
great, thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
data stored like ????? in sql server column 19 53
SQL Server 2012 Database Restore 4 38
Amazon RDS migrate to SQL Server 3 24
Row insertion failed. Array 5 45
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question