Solved

convert function help plese

Posted on 2009-05-06
3
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL syntax for max(date) 3 39
Replace statements HTML with HTML IF 8 67
Any benefit to adding a Clustered index here? 4 40
Report 8 27
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.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

752 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