Solved

convert function help plese

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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
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.

747 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

9 Experts available now in Live!

Get 1:1 Help Now