?
Solved

convert function help plese

Posted on 2009-05-06
3
Medium Priority
?
266 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ready to get certified? Check out some courses that help you prepare for third-party exams.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

862 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