Solved

convert function help plese

Posted on 2009-05-06
3
249 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 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

939 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now