We need the sql script to query the table Ditronics.Kiosk.Journal to find journal with mismatch denom information versus amount.
CREATE TABLE #MoneyTable
(
Id INT IDENTITY(1, 1)
PRIMARY KEY ,
MoneyName VARCHAR(50) ,
Cents INT
)
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'UnSupported', 0 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarOne', 100 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTwo', 200 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarFive', 500 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTen', 1000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTwenty', 2000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarFifty', 5000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarHundred', 10000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentOne', 1 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentFive', 5 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentTen', 10 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentTwentyFive', 25 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentFifty', 50 ) SELECT id ,
Payload.value('(TransactionJournal/TransactionDetail/BillBreakTransactionDetail/BillBreakDetail/MoneyDenom/denom)[1]',
'varchar(50)') AS 'MoneyName' ,
Payload.value('(TransactionJournal/TransactionDetail/Amount)[1]',
'int') AS 'Cents' ,
Payload.value('(TransactionJournal/TransactionDualDetail/BillBreakTransactionDetail/BillBreakDetail/MoneyDenom/denom)[1]',
'varchar(50)') AS 'DualMoneyName' ,
Payload.value('(TransactionJournal/TransactionDualDetail/Amount)[1]', --2.Search the specified node in the specified field
'int') AS 'DualCents'
INTO #tempJournal --1.Don't to state create #tempJournal
FROM Kiosk.Journal
WHERE ModuleTypeId = 3 SELECT *
FROM Kiosk.Journal
WHERE id NOT IN ( SELECT t1.id
FROM #tempJournal t1 ,
#MoneyTable t2
WHERE ( t1.MoneyName = t2.MoneyName
AND t1.Cents = t2.Cents
AND t1.DualMoneyName IS NULL
AND t1.DualCents IS NULL
)
OR ( t1.DualMoneyName = t1.MoneyName
AND t1.DualCents = t2.Cents
AND t1.MoneyName IS NULL
AND t1.Cents IS NULL
) )
AND ModuleTypeId = 3 DROP TABLE #MoneyTable
DROP TABLE #tempJournal
We need the sql script to query the table Ditronics.Kiosk.Journal to find journal with mismatch denom information versus amount.的更多相关文章
- MySQL5.7: sql script demo
-- MyISAM Foreign Keys显示不了外键,MyISAM此为5.0 以下版本使用 InnoDB 为5.0以上版本使用 drop table IF EXISTS city; CREATE ...
- SQLite: sql script demo
如果有成熟的架构,如何根据数据库关系的表.视图等,进行代码生成架构?减少写代码的时间? -- 考虑主键外键 -- create database geovindu; use geovindu; --2 ...
- csharp:SMO run sql script
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- doris: shell invoke .sql script for doris and passing values for parameters in sql script.
1. background in most cases, we want to execute sql script in doris routinely. using azkaban, to l ...
- 解决java.sql.SQLException: ORA-01789: query block has incorrect number of result columns
java.sql.SQLException: ORA-01789: query block has incorrect number of result columns at oracle.jdbc. ...
- 可重复执行的SQL Script
问题 在工作中偶尔会遇到这样的问题:SQL script重复执行时会报错. 理想的状态下,SQL script跑一遍就够了,是不会重复执行的,但是实际情况往往很复杂. 比如Dev同学在开发时在A环境把 ...
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
In this Document Goal Solution 1: How do you enable trace for an API when executed from a SQL ...
- How to import .sql script
How to import .sql script 1.Export .sql from pl/sql developer you can reference to other document in ...
- persistent.xml hibernate 利用sql script 自定义生成 table 表
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http:// ...
随机推荐
- python学习笔记18(UliPad 初体验)
在windows下安装配置Ulipad 由于UliPad 是由wxPython 开发的,所以,需要先安装wxPython . wxPython下载地址: http://www.wxpython.org ...
- WDC2106 iOS10新特性及开发者要注意什么
昨晚苹果在旧金山召开了WWDC,看了WWDC2016直播,我们发现变得谨慎而开放的苹果在新一版四大平台系统中展示了很多变化,当然重中之重还是伟大的iOS.通过试用iOS10beta版,除了长大了的更强 ...
- 实时数据处理环境搭建flume+kafka+storm:3.kafka安装
1. 解压 tar -zxvf 2.配置/app/kafka_2.9.2-0.8.1.1/config/server.properties #标识-- broker.id=0 ...
- Flex 调用webService
今天手头没事,就学习下 Flex 调用webService的方法.本地测试OK 和大家分享下. ——————————————————————————————————————————————————— ...
- Connect to the mysql dataase from remote server
Make sure that the firewall is closed!!!!!!!!! shell command should be like is: mysql -u username -p ...
- Java中List的排序
第一种方法,就是list中对象实现Comparable接口,代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 ...
- SOA基础
每个系统上都有多种业务逻辑,这就像在一个小超市中,一个人负责收银.清洁.摆货.咨询等各种各样的事情,当来超市的顾客多到一定程度,这个人就没办法再负责这么多的事情了,系统也同样如此. 第一个现象就是系统 ...
- 【剑指offer】数字在排序数组中出现的次数
2013-09-02 16:28:35 找出数字在排序数组中出现的次数. 注意几点: 一开始试图用size_t类型表示数组的下标begin.end,到那时这样做在end = 0时,end - 1是si ...
- C#.Net 如何动态加载与卸载程序集(.dll或者.exe)3---- 动态加载Assembly应用程序
下载 supergraphfiles.exe 示例文件. 应用程序体系结构 在我专攻代码之前,我想谈谈我尝试做的事.您可能记得,SuperGraph 让您从函数列表中进行选择.我希望能够在具体的目录中 ...
- 查看Linux系统的版本以及位数
1.查看版本 http://jingyan.baidu.com/article/215817f7e360bd1edb142362.html[root@localhost usr]# lsb_relea ...