Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wallywizard
Starting Member
2 Posts |
Posted - 2014-08-06 : 14:10:59
|
I am trying to add a field (bank_chk_amt] from a table in to my query to bring in a dollar amount....I originally had this belowSELECT dbo.CBPAYMENT.REFERENCE_NO, 'CCMCCHBREF' AS Literal, RTrim([description]) + ', ' + [bank_chk_amt] + ', ' + convert(char(10),[check_date],101) + ', ' + 'Refund check sent to ' + [payee_name] AS [Free Text]FROM dbo.CBPAYMENT;but I would get "Error converting data type varchar to numeric".So my co-worker modified it and added (str([bank_chk_amt]) to my query which worked, but I noticed it dropped of the cents. So instead of 80.35 it would show 80 And I noticed it rounded 100.50 to 101How can I bring in the full dollar amount and without adding? |
|
wallywizard
Starting Member
2 Posts |
Posted - 2014-08-06 : 14:13:49
|
edit------------I meant to say at the end, how can I bring in the full dollar amount and without rounding? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-08-06 : 14:32:08
|
Return raw data from SQL. If you need to form a string based on the columns returned, do that in your application. Presentation issues should be handled in the application layer, not in SQL.SELECT REFERENCE_NO, 'CCMCCHBREF' AS Literal, RTrim([description]), bank_chk_amt, check_date, payee_name AS [Free Text]FROM dbo.CBPAYMENT;Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|
|
|