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:// ...
随机推荐
- MINA快速传输文件
最近的项目使用MNA进行文件传输,只能传输到5~7MB/s:但是使用FTP等软件其实可以达到11MB/s,后来使用MINA原生传输,发现可以达到11MB/s,后来发现有以下两点可以需要注意优化: 1. ...
- shutdown彻底关闭tomcat,以及多线程关闭
最近做的一个Web项目,发现shutdown.sh后,无法关掉tomcat进程. ps -ef | grep tomcat 返回tomcat进程仍然存在.经过调查发现是因为在Web应用中启动了线程池, ...
- IOS9中出现的错误
1,Bitcode 错误提示: ld: '/Applications/Cocos/frameworks/cocos2d-x-3.8.1/prebuilt/ios/libcocos2d iOS.a(CC ...
- MyBatis学习笔记之resultMap
使用mybatis不能不说的是resultMap 相比resultClass来说resultMap可以适应更复杂的关系映射,允许指定字段的数据类型,支持“select *” ,并不要求定义 Resul ...
- python学习笔记27(python中sys模块的使用)
sys.argv 命令行参数List,第一个元素是程序本身路径 sys.modules.keys() 返回所有已经导入的模块列表 sys.exc_info() 获取当前正在 ...
- C# SqlConnection
public static ArrayList Connect(string connectionString, string commandText) { ArrayList retValList ...
- OD之窗口界面
- static函数与普通函数
转自http://blog.163.com/sunshine_linting/blog/static/44893323201191294825184/ 全局变量(外部变量)的说明之前再冠以static ...
- 李洪强iOS开发之使用CycleScrollView实现轮播图
01 导入头文件,并且定义CycleScrollView属性 02 初始化,设置frame并且添加到collectionView上 03 调用方法并且设置轮播的图片
- CURL 多线程问题
http://blog.csdn.net/wslz2001/article/details/12117127 默认情况下libcurl完成一个任务以后,出于重用连接的考虑不会马上关闭 如果没有新的TC ...