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 |
usafelix
Posting Yak Master
165 Posts |
Posted - 2015-01-30 : 04:01:19
|
(trx_dat.trx_sub_disamt/nullif(trx_hdr.trx_acc_amt,0))*100 decimal(10,2) as "% per " Run this query is error. |
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-01-30 : 04:33:29
|
Can you post the error?However, you probably have 0's in trx_acc_amd column and you are replacing them by NULLs and you can't divide by NULL------------------------PS - Sorry my bad english |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-01-30 : 09:17:45
|
quote: Originally posted by jleitao Can you post the error?However, you probably have 0's in trx_acc_amd column and you are replacing them by NULLs and you can't divide by NULL------------------------PS - Sorry my bad english
Sure you can divide by null!e.g.select 1/null as 'divide by null' returns:divide by nullNULL |
|
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-01-30 : 09:21:11
|
thanks gbritton, you right :)usafelix, can you post the error?------------------------PS - Sorry my bad english |
|
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-01-30 : 09:28:17
|
CAST((trx_dat.trx_sub_disamt/nullif(trx_hdr.trx_acc_amt,0))*100 as decimal(10,2)) as "% per" but, post the error------------------------PS - Sorry my bad english |
|
|
|
|
|