嗨,我有一些问题
如果某些算法有问题,需要按列检查是否为空或零
这是一张桌子:
col1 col2 col3 col4
1 0 3376 0
2 600 null 14468.5714
3 null 0 0
4 600 3376 null
Run Code Online (Sandbox Code Playgroud)
COALESCE
零“0”值不起作用,case
它太大了
需要意识到其中的一些
, CAST(COALESCE(col2, (col3/7), (col4/30)) as money) col2
, CAST(COALESCE(col3, (col2*7), (col4/30*7))as money) col3
, CAST(COALESCE(col4, (col3/7*30),(col2*30))as money) col4
Run Code Online (Sandbox Code Playgroud)
如何以最快的方式解决这个问题。比X
我有两个方法,对我来说需要从一个到另一个生成异常,就像这样
public void Method1()
{
try
{
Method2(1);
}
catch(Exception e )
{
SendEmail (/* some message */)
}
}
public IEnumerable<int> Method2(int id)
{
foreach (var i in col)
{
try
{
/*Do some stuff*/
yield return i
}
catch
{
/* delegate this exception to Method1 and continue foreach loop */
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何将方法2中的异常委托给方法1并继续方法2中的foreach循环
UPD:
那怎么样?
例如:方法1 - >方法3 - >方法2 - >方法2在方法1中返回异常
UPD2:到UPD
/*Call*/
var i = new List<int>() {0, 0, 0, 0, 0, 0, 7, …
Run Code Online (Sandbox Code Playgroud)