The longest procedure

xiaoxiao2021-03-06  86

Create procedure dbo.money_selectsumfobyserverid_ffokadmin@serverid Intas -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- DECLARE @Hou MONEYDECLARE @Yang MONEYDECLARE @Ma MONEYDECLARE @She MONEYDECLARE @Long MONEYDECLARE @Tu MONEYDECLARE @Hu MONEYDECLARE @Niu MONEYDECLARE @Shu MONEYDECLARE @Zhu MONEYDECLARE @Gou MONEYDECLARE @Ji MONEYDECLARE @Dan MONEYDECLARE @Shuang MONEYDECLARE @Da MONEYDECLARE @Xiao MONEYDECLARE @ N1 MONEYDECLARE @ N2 MONEYDECLARE @ N3 MONEYDECLARE @ N4 MONEYDECLARE @ N5 MONEYDECLARE @ N6 MONEYDECLARE @ N7 MONEYDECLARE @ N8 MONEYDECLARE @ N9 MONEYDECLARE @ N10 MONEYDECLARE @ N11 MONEYDECLARE @ N12 MONEYDECLARE @ N13 MONEYDECLARE @ N14 MONEYDECLARE @ N15 MONEYDECLARE @ N16 MONEYDECLARE @ N17 MONEYDECLARE @ N18 MONEYDECLARE @ N19 MONEYDECLARE @ N20 MONEYDECLARE @ N21 MONEYDECLARE @ N22 MONEYDECLARE @ N23 MONEYDECLARE @ N24 MONEYDECLARE @ N25 MONEYDECLARE @ N26 MONEYDECLARE @ N27 MONEYDECLARE @ n28 MoneyDeclare @ n29 MoneyDeclare @ N30 MoneyDeclare @ N31 MoneyDeclare @ N32 MoneyDecla RE @ N33 MONEYDECLARE @ N34 MONEYDECLARE @ N35 MONEYDECLARE @ N36 MONEYDECLARE @ N37 MONEYDECLARE @ N38 MONEYDECLARE @ N39 MONEYDECLARE @ N40 MONEYDECLARE @ N41 MONEYDECLARE @ N42 MONEYDECLARE @ N43 MONEYDECLARE @ N44 MONEYDECLARE @ N45 MONEYDECLARE @ N46 MONEYDECLARE @ N47 MONEYDECLARE @ N48 MONEYDECLARE @ N49 MONEY ------------------------------------ ---------------- SELECT @ hou = SUM (HOU), @ yang = sum (yang), @ ma = sum (mA), @ she = sum (she), @ Long =

Sum (long), @ TU = SUM (TU), @ hu = sum (hu), @ niu = sum (niu), @ shu = sum (shu), @ zhu = sum (zhu), @gou = sum Gou), @ ji = sum (ji), @ DAN = SUM (DAN), @ shuan = sum (shuan), @ da = sum (da), @ xiao = sum (xiao), @ n1 = sum (N1) , @ N2 = sum (N2), @ n3 = sum (N3), @ n4 = sum (n4), @ n5 = sum (n5), @ n6 = sum (n6), @ n7 = sum (N7), @ N8 = sum (n8), @ n9 = sum (n9), @ n10 = sum (N10), @ n11 = sum (N11), @ n12 = sum (N12), @ n13 = sum (N13), @ n14 = SUM (N14), @ n15 = sum (n15), @ n16 = sum (N16), @ n17 = sum (N17), @ n18 = sum (n18), @ n19 = sum (n19), @ n20 = sum N20), @ n21 = sum (N21), @n22 = sum (N22), @ n23 = sum (n23), @ n24 = sum (N24), @ n25 = sum (N25), @ n26 = sum (N26) , @ N27 = sum (N27), @ n28 = sum (N28), @ n29 = sum (N29), @ n30 = sum (N30), @ n31 = sum (N31), @ n32 = sum (N32), @ N33 = SUM (N33), @ n34 = sum (N34), @ n35 = sum (N35), @ n36 = sum (N36), @ n37 = sum (N37), @ n38 = sum (N38), @ n39 = SUM (N39), @ N40 = SUM (N40), @ n41 = sum (N41), @ n42 = sum (n42), @ n43 = sum (n43), @ n44 = sum (n44), @ n45 = sum N45), @ N46 = SUM (N46), @ n47 = sum (N47), @ n48 = sum (n48), @ n49 = sum (n49) from Money Mjoin (Select ID from [user] where agent = 'ffokadmin' ) uonm.userid = u.idwhere serverid = @ ServerID ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- ---- DECLARE @agent_idx varchar (40) - Record Agent name DECLARE @agent_tel float - Record number of shares DECLARE Agent_Cursor CURSOR FORselect distinct agent from [user] where id in (select distinct userid from money where ServerId = @ ServerId) And Agent <

> 'FFOKADMIN'Open Agent_cursor ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - - - - - - - - - - - - -

IF @agent_idx <> 'begin - begin if set @Agent_tel = (SELECT TEL from agent where idx = @Agent_idx) - Get Shares - - SELECT @ Hou = SUM (HOU) * ( 1- @ Agent_Tel) @ hou, @ yang = SUM (YANG) * (1- @ Agent_tel) @ yang, @ ma = sum (mA) * (1- @ Agent_tel) @ ma, @ She = SUM SHE) * (1- @ agent_tel) @ she, @ long = SUM (long) * (1- @ Agent_tel) @ long, @ TU = SUM (TU) * (1- @ Agent_tel) @ TU, @ Hu = SUM (HU) * (1- @ agent_tel) @ hu, @ niu = sum (niu) * (1- @ agent_tel) @ niu, @ Shu = SUM (SHU) * (1- @ Agent_TEL) @ Shu, @ zhu = SUM (zhu) * (1- @ agent_tel) @ zhu, @gou = SUM (GOU) * (1- @ Agent_tel) @gou, @ ji = SUM (Ji) * (1- @Agent_tel) @ ji, @ Dan = SUM (DAN) * (1- @ Agent_tel) @ Dan, @ shuan = SUM (SHUANG) * (1- @ Agent_tel) @ shuan, @ da = SUM (DA) * (1- @ agent_tel) @ da, @ xiao = SUM (XIAO) * (1- @ Agent_tel) @ xiao, @ n1 = SUM (N1) * (1- @ Agent_tel) @ n1, @ n2 = SUM (N2) * (1- @ agent_tel) @ n2, @ n3 = SUM (N3) * (1- @ agent_tel) @ n3, @ n4 = SUM (N4) * (1- @ Agent_tel) @ n4 , @ N5 = sum (N5) * (1- @ agent_tel) @ n5, @ n6 = SUM (N6) * (1- @ agent_tel) @ n6, @ n7 = sum (N7) * (1- @ Agent_tel ) @ N7, @ n8 = sum (n8) * (1- @ agent_tel) @ n8, @ n9 = SUM (N9) * (1- @ Agent_tel) @ N9, @ n10 = sum (N10) * ( 1- @ agent_tel) @ n10, @ n11 = sum N11) * (1- @ agent_tel) @ n11, @ n12 = sum (n12) * (1- @ agent_tel) @ N12, @ n13 = SUM (N13) * (1- @ agent_tel) @ n13, @ N14 = SUM (N14) * (1- @

Agent_tel) @ n14, @ n15 = sum (n15) * (1- @ agent_tel) @ n15, @ n16 = sum (N16) * (1- @ agent_tel) @ n16, @ n17 = sum (N17) * (1- @ agent_tel) @ n17, @ n18 = SUM (N18) * (1- @ agent_tel) @ n18, @ n19 = SUM (N19) * (1- @ agent_tel) @ n19, @ n20 = SUM (N20) * (1- @ agent_tel) @ n20, @ n21 = sum (n21) * (1- @ agent_tel) @ n21, @ n22 = sum (N22) * (1- @ agent_tel) @ N22, @ N23 = sum (N23) * (1- @ Agent_tel) @ n23, @ n24 = sum (n24) * (1- @ agent_tel) @ n24, @ n25 = SUM (N25) * (1- @ agent_tel) @ N25, @ n26 = sum (n26) * (1- @ agent_tel) @ n26, @ n27 = sum (n27) * (1- @ agent_tel) @ n27, @ n28 = sum (N28) * (1 - @ agent_tel) @ n28, @ n29 = SUM (N29) * (1- @ agent_tel) @ n29, @ N30 = SUM (N30) * (1- @ Agent_tel) @ N30, @ n31 = sum (N31 ) * (1- @ agent_tel) @ n31, @ n32 = sum (N32) * (1- @ agent_tel) @ n32, @ n33 = SUM (N33) * (1- @ agent_tel) @ n33, @ n34 = SUM (N34) * (1- @ Agent_tel) @ N34, @ N35 = SUM (N35) * (1- @ agent_tel) @ n35, @ N36 = SUM (N36) * (1- @ Agent_tel) @ N36, @ N37 = SUM (N37) * (1- @ Agent_tel) @ N37, @ n38 = SUM (N38) * (1- @ agent_tel) @ n38, @ n39 = sum (N39) * (1- @ Agent_tel) @ n39, @ n40 = sum (n40) * (1- @ agent_tel) @ n40, @ n41 = sum (n41) * (1- @ agent_tel) @ n41, @ n42 = SUM (N42) * (1- @ agent_tel) @ n42, @ n43 = sum (n43) * (1- @ agent_tel) @ n4 3, @ n44 = sum (n44) * (1- @ Agent_tel) @ n44, @ n45 = sum (n45) * (1- @ agent_tel) @ n45, @ n46 = sum (n46) * (1- @ Agent_tel) @

N46, @ N47 = SUM (N47) * (1- @ Agent_tel) @ N47, @ n48 = SUM (N48) * (1- @ agent_tel) @ n48, @ n49 = sum (n49) * (1- @ Agent_tel) @ n49 from [user] where agent = @Agent_idx) u @ @@fetch_status = 0begin - Begin While Set @Agent_idx = '' - Air Fetch next from agent_cursor @Agent_IDX

IF @agent_idx <> 'begin - begin if set @Agent_tel = (SELECT TEL from agent where idx = @Agent_idx) - Get Shares - - SELECT @ Hou = SUM (HOU) * ( 1- @ Agent_Tel) @ hou, @ yang = SUM (YANG) * (1- @ Agent_tel) @ yang, @ ma = sum (mA) * (1- @ Agent_tel) @ ma, @ She = SUM SHE) * (1- @ agent_tel) @ she, @ long = SUM (long) * (1- @ Agent_tel) @ long, @ TU = SUM (TU) * (1- @ Agent_tel) @ TU, @ Hu = SUM (HU) * (1- @ agent_tel) @ hu, @ niu = sum (niu) * (1- @ agent_tel) @ niu, @ Shu = SUM (SHU) * (1- @ Agent_TEL) @ Shu, @ zhu = SUM (zhu) * (1- @ agent_tel) @ zhu, @gou = SUM (GOU) * (1- @ Agent_tel) @gou, @ ji = SUM (Ji) * (1- @Agent_tel) @ ji, @ Dan = SUM (DAN) * (1- @ Agent_tel) @ Dan, @ shuan = SUM (SHUANG) * (1- @ Agent_tel) @ shuan, @ da = SUM (DA) * (1- @ agent_tel) @ da, @ xiao = SUM (XIAO) * (1- @ Agent_tel) @ xiao, @ n1 = SUM (N1) * (1- @ Agent_tel) @ n1, @ n2 = SUM (N2) * (1- @ agent_tel) @ n2, @ n3 = SUM (N3) * (1- @ agent_tel) @ n3, @ n4 = SUM (N4) * (1- @ Agent_tel) @ n4 , @ N5 = sum (N5) * (1- @ agent_tel) @ n5, @ n6 = SUM (N6) * (1- @ agent_tel) @ n6, @ n7 = sum (N7) * (1- @ Agent_tel ) @ N7, @ n8 = sum (n8) * (1- @ agent_tel) @ n8, @ n9 = SUM (N9) * (1- @ Agent_tel) @ N9, @ n10 = sum (N10) * ( 1- @ agent_tel) @ n10, @ n1 1 = SUM (N11) * (1- @ Agent_TEL) @ N11, @ N12 = SUM (N12) * (1- @ Agent_tel) @ N12, @ n13 = SUM (N13) * (1- @ Agent_tel) @ N13, @ n14 = sum (n14) * (1- @

Agent_tel) @ n14, @ n15 = sum (n15) * (1- @ agent_tel) @ n15, @ n16 = sum (N16) * (1- @ agent_tel) @ n16, @ n17 = sum (N17) * (1- @ agent_tel) @ n17, @ n18 = SUM (N18) * (1- @ agent_tel) @ n18, @ n19 = SUM (N19) * (1- @ agent_tel) @ n19, @ n20 = SUM (N20) * (1- @ agent_tel) @ n20, @ n21 = sum (n21) * (1- @ agent_tel) @ n21, @ n22 = sum (N22) * (1- @ agent_tel) @ N22, @ N23 = sum (N23) * (1- @ Agent_tel) @ n23, @ n24 = sum (n24) * (1- @ agent_tel) @ n24, @ n25 = SUM (N25) * (1- @ agent_tel) @ N25, @ n26 = sum (n26) * (1- @ agent_tel) @ n26, @ n27 = sum (n27) * (1- @ agent_tel) @ n27, @ n28 = sum (N28) * (1 - @ agent_tel) @ n28, @ n29 = SUM (N29) * (1- @ agent_tel) @ n29, @ N30 = SUM (N30) * (1- @ Agent_tel) @ N30, @ n31 = sum (N31 ) * (1- @ agent_tel) @ n31, @ n32 = sum (N32) * (1- @ agent_tel) @ n32, @ n33 = SUM (N33) * (1- @ agent_tel) @ n33, @ n34 = SUM (N34) * (1- @ Agent_tel) @ N34, @ N35 = SUM (N35) * (1- @ agent_tel) @ n35, @ N36 = SUM (N36) * (1- @ Agent_tel) @ N36, @ N37 = SUM (N37) * (1- @ Agent_tel) @ N37, @ n38 = SUM (N38) * (1- @ agent_tel) @ n38, @ n39 = sum (N39) * (1- @ Agent_tel) @ n39, @ n40 = sum (n40) * (1- @ agent_tel) @ n40, @ n41 = sum (n41) * (1- @ agent_tel) @ n41, @ n42 = SUM (N42) * (1- @ agent_tel) @ n42, @ n43 = sum (n43) * (1- @ agent_tel) @ n4 3, @ n44 = sum (n44) * (1- @ Agent_tel) @ n44, @ n45 = sum (n45) * (1- @ agent_tel) @ n45, @ n46 = sum (n46) * (1- @ Agent_tel) @

N46, @ N47 = SUM (N47) * (1- @ Agent_tel) @ N47, @ n48 = SUM (N48) * (1- @ agent_tel) @ n48, @ n49 = sum (n49) * (1- @ Agent_tel) @ n49 from Money M Join (Select ID from [user] where agent = @Agent_idx) u on m.userid = u.id where serverid = @ Serverid end - end = @ Serverid end - end = - - - - - - - - - - - - - - - - ---------------------------------------------------------------------------------------------------------------------- --------------- Close Agent_Cursordeallocate Agent_Cursor -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------- SELECT HOU = @ hou, yang = @ yang, ma = @ ma, she = @ She, long = @ long, tu = @ Tu, hu = @ hu, niu = @ niu, shu = @ shu, zhu = @ zhu, gou = @gou, ji = @ ji, dan = @ Dan, shuan = @ Shuang, da = @ da, xiao = @ xiao, n1 = @ n1, n2 = @ n2, n3 = @ n3, n4 = @ n4, n5 = @ n5, n6 = @ n6, n7 = @ n7, n8 = @ N8, n9 = @ N9, N10 = @ N10, N11 = @ n11, n12 = @ N12, n13 = @ N13, N14 = @ N14, N15 = @ N15, N16 = @ N16, N17 = @ N17, N18 = @ N18, n19 = @ N19, N20 = @ N20, N21 = @ N21, N22 = @ N22, N23 = @ N23, N24 = @ N24, N25 = @ N25, N26 = @ N26, N27 = @ N27, N28 = @ N28, N29 = @ N29, N30 = @ N30, N31 = @ N31, N32 = @ N32, N33 = @ N33, N34 = @ N34, N35 = @ N35, N36 = @ N36, N37 = @ N37, N38 = @ N38, N39 = @ N39, N40 = @ N40, N41 = @ N41, N42 = @ N42, N43 = @ N43, N44 = @ N44, N45 = @ N45, N46 = @ N46, N 47 = @ n47, n48 = @ n48, n49 = @ n49go

转载请注明原文地址:https://www.9cbs.com/read-105927.html

New Post(0)