本文介绍了如何将以下存储过程转移到MySQL存储过程中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CREATE PROCEDURE [dbo]。[TrialBalance] AS SELECT COA_T .AccCode AS [Account Code],COA_T.AccName AS [Account Name],

CASE WHEN(COA_T.AccType in CASE) ('现金和现金等价物','有价证券','应收账款','存货','预付费用','固定资产','无形资产','投资','其他非流动资产','应付账款','应计费用','短期贷款','当前部分长期债务','应付所得税','信贷额度','定期贷款','资本','本年度盈利,'留存收益','股息','股本','资本支付','未结余额','销售收入','营业费用','行政费用')和COA_T.AccTransCate in(' BS','PL')和COA_T.AccTransSubCate in('ASS','LBT','EQU','REV','EXP')

THEN DebitAmt-CreditAmt ELSE 0 END)> ; 0那么(总和(COA_T.Acc中的情况)('现金和现金等价物','有价证券','应收账款','存货','预付费用','固定资产','无形资产','投资','其他非流动资产','应付账款','应计费用','短期贷款','当前部分长期债务','应付所得税','信用额度','定期贷款','资本','当年收益','留存收益','股息','股本','资本支付','未结余额','销售收入','营业费用','管理费用')和COA_T.AccTransCate('BS','PL')和COA_T.AccTransSubCate in('ASS','LBT','EQU','REV','EXP')

THEN DebitAmt-CreditAmt end))ELSE 0 END AS [借方],



情况何时(COA_T.Acc类型为(现金和现金等价物) ,'有价证券','应收账款',存货,'预付费用','固定资产','无形资产','投资','其他非流动资产','应付账款','应计费用','短期贷款','当前部分长期债务,应付所得税,信贷额度,定期贷款,资本,当年收益,留存收益,股息,股本,付款在''''''''','''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ','EQU','REV','EXP')

那么DebitAmt-CreditAmt ELSE 0 END)< 0那么(总和(COA_T.Acc中的情况)('现金和现金等价物','有价证券','应收账款','存货','预付费用','固定资产','无形资产','投资','其他非流动资产','应付账款','应计费用','短期贷款','当前部分长期债务','应付所得税','信用额度','定期贷款','资本','当年收益','留存收益','股息','股本','资本支付','未结余额','销售收入','营业费用','管理费用')和COA_T.AccTransCate('BS','PL')和COA_T.AccTransSubCate in('ASS','LBT','EQU','REV','EXP')

那么DebitAmt-CreditAmt结束))ELSE 0结束作为[信用]



来自COA_T加入Trans_T ON COA_T.AccName = Trans_T.AccName

WHERE COA_T.AccType in('Cash&Cash Equivalents','M arketable Securities','应收账款','存货','预付费用','固定资产','无形资产','投资','其他非流动资产','应付账款','应计费用', 短期贷款,目前的长期债务部分,应付所得税,信贷额度,定期贷款,资本,当年收益,留存收益,股息','股本','资本支付','未结余额','销售收入','营业费用','行政费用')和COA_T.AccTransCate('BS','PL')和COA_T .AccTransSubCate in('ASS','LBT','EQU','REV','EXP')

GROUP BY COA_T.AccCode,COA_T.AccName ORDER BY COA_T.AccCode

CREATE PROCEDURE [dbo].[TrialBalance] AS SELECT COA_T .AccCode AS [Account Code], COA_T.AccName AS [Account Name],
CASE WHEN SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
THEN DebitAmt-CreditAmt ELSE 0 END) > 0 THEN (SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses') and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
THEN DebitAmt-CreditAmt end )) ELSE 0 END AS [Debit],

CASE WHEN SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
THEN DebitAmt-CreditAmt ELSE 0 END) < 0 THEN (SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses') and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
THEN DebitAmt-CreditAmt end )) ELSE 0 END AS [Credit]

FROM COA_T JOIN Trans_T ON COA_T.AccName = Trans_T.AccName
WHERE COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
GROUP BY COA_T.AccCode,COA_T.AccName ORDER BY COA_T.AccCode

推荐答案

CREATE PROCEDURE TrialBalance()
BEGIN
SELECT COA_T .AccCode AS [Account Code], COA_T.AccName AS [Account Name], 
CASE WHEN SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP') 
THEN DebitAmt-CreditAmt ELSE 0 END) > 0 THEN (SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses') and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP') 
THEN DebitAmt-CreditAmt end )) ELSE 0 END AS [Debit],
CASE WHEN SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP') 
THEN DebitAmt-CreditAmt ELSE 0 END) < 0 THEN (SUM (CASE WHEN COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses') and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP') 
THEN DebitAmt-CreditAmt end )) ELSE 0 END AS [Credit]
FROM COA_T JOIN Trans_T ON COA_T.AccName = Trans_T.AccName
WHERE COA_T.AccType in ('Cash & Cash Equivalents ','Marketable Securities','Accounts Receivable','Inventories','Prepaid Expenses','Fixed Asset','Intangible Asset','Investments','Other Non-current Assets','Accounts Payable','Accrued Expenses','Short-term Loans','Current Portion of Long-term Debt','Income Taxes Payable','Line of Credit','Term Loan','Capital','Current Year Earnings','Retained Earnings','Dividends','Share Capital','Paid in Capital','Open Balance','Sales Revenue','Operating Expenses','Administrative expenses')and COA_T.AccTransCate in ('BS','PL') and COA_T.AccTransSubCate in ('ASS','LBT', 'EQU', 'REV', 'EXP')
GROUP BY COA_T.AccCode,COA_T.AccName ORDER BY COA_T.AccCode
END


这篇关于如何将以下存储过程转移到MySQL存储过程中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 19:25