查找超过指定交易金额的帐户

时间:2017-04-12 23:11:52

标签: sql-server

我有一个包含两个表https://www.myapp.io/homeserver { listen 443 ssl; server_name myapp.io www.myapp.io; ssl_certificate /etc/letsencrypt/live/myapp.io/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/myapp.io/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_dhparam /etc/ssl/certs/dhparam.pem; ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:EC$ ssl_session_timeout 1d; ssl_stapling on; ssl_stapling_verify on; add_header Strict-Transport-Security max-age=15768000; index index.html; root /opt/myapp location / { try_files $uri $uri/ /index.html; } location ~ /.well-known { allow all; } location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Accept-Encoding ""; proxy_set_header Proxy ""; proxy_pass https://127.0.0.1:3000; # These three lines added as per https://github.com/socketio/socket.io/issues/1942 to remove sock$ proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } 的银行数据库。

accountmaster有列:

transactionmaster

Accountmaster列:

accid(pk)
accname
bal
branch 

我想在不使用触发器的情况下找到以下内容。

  1. 只要账户持有人进行交易(交易类型如存款,取款),它应反映在账户管理员表的余额中。

  2. 只要帐户持有人进行交易> 50000(撤回或存款),交易细节将被插入新表' hightransaction'并删除transactionmaster表中的特定事务。

  3. 我试过这样的事情,但结果只显示了列名,没有值。

    首先,我将transactionmaster复制到newtable hightransaction

    Transactionmaster

    然后我创建了一个触发器

    Tnumber(pk)
    dot
    txnAmt
    transactiontype
    accid(fk)
    branch(fk)
    

    我尝试执行

    select * 
    into hightransaction 
    from transactionmaster
    where 1 = 2
    

    输出只是列名而没有值。

1 个答案:

答案 0 :(得分:0)

我正在考虑这样的存储过程。

CREATE PROCEDURE [dbo].[transaction]
@transactionAmt int 
/*
ADD OTHER PARAMETERS HERE
*/ 
AS
BEGIN
SET NOCOUNT ON;

 IF (@transactionAmt > 50000)
  BEGIN
    /*INSERT STATEMENT FOR HIGHTRANSCTION TABLE*/
  END
 ELSE
  BEGIN
    /*INSERT STATEMENT FOR TRANSACTIONMASTER TABLE*/
  END
END
GO

这可以让您控制应用程序,并可以将参数传递给存储过程。