You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sql-tools/修复合并问题2.sql

631 lines
9.2 KiB

1 year ago
declare @index int
select @index = 1;
goto BeginTask
RunTask:
print db_name()
---------------------------------------------
IF DB_NAME () != 'SaiDao_Temp' AND DB_NAME () != 'LSS'AND DB_NAME () != 'SaiDao_Demo'
AND DB_NAME() != 'SaiDao_Hubei'
IF EXISTS(
SELECT * FROM
(
SELECT FCardId,FAcctId,FBalance
FROM TMemberCardAccount
) AS T1,
(
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
FROM TMemberCardAcctHist
GROUP BY FCardId,FAcctId
) AS T2
WHERE T1.FCardId = T2.FCardId
AND T1.FAcctId = T2.FAcctId
AND T2.FBalance != T1.FBalance
)
BEGIN
SELECT db_name()
SELECT * FROM
(
SELECT T1.FCardId,T1.FAcctId,T1.FBalance,T3.FCardNo
FROM TMemberCardAccount AS T1,TMemberCard AS T3
WHERE T3.FCardId = T1.FCardId
) AS T1,
(
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
FROM TMemberCardAcctHist
GROUP BY FCardId,FAcctId
) AS T2
WHERE T1.FCardId = T2.FCardId
AND T1.FAcctId = T2.FAcctId
AND T2.FBalance != T1.FBalance
END
/*
declare @cmd varchar(1111)
select @cmd = 'osql -S(local) -Usa -P"S~a!i@D#a$o%8^8&0*6(0)6_3+" -d'master' -iE:\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\update.sql'
EXEC xp_cmdshell @cmd
*/
---------------------------------------------
SELECT @index = @index + 1
BeginTask:
IF @Index = 1
BEGIN
use QingDao_NiSiKa_DRF
goto RunTask
END
ELSE IF @Index = 2
BEGIN
use LaiYang_HuaYun
goto RunTask
END
ELSE IF @Index = 3
BEGIN
use ZhengZhou_HaiRunManHaDun
goto RunTask
END
ELSE IF @Index = 4
BEGIN
use DongYing_PLBB
goto RunTask
END
ELSE IF @Index = 5
BEGIN
use SaiDao_ShanXi
goto RunTask
END
ELSE IF @Index = 6
BEGIN
use SaiDao_Demo
goto RunTask
END
ELSE IF @Index = 7
BEGIN
use YanTai_RunSiFang
goto RunTask
END
ELSE IF @Index = 8
BEGIN
use QingDao_NiSiKa
goto RunTask
END
ELSE IF @Index = 9
BEGIN
use QingDao_JinDian
goto RunTask
END
ELSE IF @Index = 10
BEGIN
use QingDao_LaFeiPaiRui
goto RunTask
END
ELSE IF @Index = 11
BEGIN
use QingDao_HeChen
goto RunTask
END
ELSE IF @Index = 12
BEGIN
use TaiYuan_TouFaChangLe
goto RunTask
END
ELSE IF @Index = 13
BEGIN
use QingDao_YanSe
goto RunTask
END
ELSE IF @Index = 14
BEGIN
use QingDao_DaDaShiDa
goto RunTask
END
ELSE IF @Index = 15
BEGIN
use QingDao_ME
goto RunTask
END
ELSE IF @Index = 16
BEGIN
use SaiDao_Hubei
goto RunTask
END
ELSE IF @Index = 17
BEGIN
use XiNing_MingZhi
goto RunTask
END
ELSE IF @Index = 18
BEGIN
use ShouGuang_JinGongZi
goto RunTask
END
ELSE IF @Index = 19
BEGIN
use QingDao_DaLiangZao
goto RunTask
END
ELSE IF @Index = 20
BEGIN
use TaiYuan_ChengYi_01
goto RunTask
END
ELSE IF @Index = 21
BEGIN
use ZhengZhou_HaiRunWenGeHua
goto RunTask
END
ELSE IF @Index = 22
BEGIN
use QingDao_ShangDiLi
goto RunTask
END
ELSE IF @Index = 23
BEGIN
use YunCheng_ShouXuan
goto RunTask
END
ELSE IF @Index = 24
BEGIN
use TaiYuan_XiMenXuan
goto RunTask
END
ELSE IF @Index = 25
BEGIN
use XinZhou_BaiTianE
goto RunTask
END
ELSE IF @Index = 26
BEGIN
use SaiDao_ShanXiDemo
goto RunTask
END
ELSE IF @Index = 27
BEGIN
use BaoTou_MeiJueShi
goto RunTask
END
ELSE IF @Index = 28
BEGIN
use TaiYuan_BaYa
goto RunTask
END
ELSE IF @Index = 29
BEGIN
use DongYing_JiangRenWuQu
goto RunTask
END
ELSE IF @Index = 30
BEGIN
use DongYing_DongHua
goto RunTask
END
ELSE IF @Index = 31
BEGIN
use DongYing_ANan
goto RunTask
END
ELSE IF @Index = 32
BEGIN
use DongYing_LiRenDao
goto RunTask
END
ELSE IF @Index = 33
BEGIN
use DongYing_JiangRenYuHua
goto RunTask
END
ELSE IF @Index = 34
BEGIN
use TaiYuan_ChengYi_02
goto RunTask
END
ELSE IF @Index = 35
BEGIN
use TaiYuan_JinRiShuoFa
goto RunTask
END
ELSE IF @Index = 36
BEGIN
use HuHeHaoTe_HeQi
goto RunTask
END
ELSE IF @Index = 37
BEGIN
use XiaoYi_OSA
goto RunTask
END
ELSE IF @Index = 38
BEGIN
use WeiFang_XiMei
goto RunTask
END
ELSE IF @Index = 39
BEGIN
use ShanTou_Demo1
goto RunTask
END
ELSE IF @Index = 40
BEGIN
use QingDao_AC
goto RunTask
END
ELSE IF @Index = 41
BEGIN
use ChangSha_Demo1
goto RunTask
END
ELSE IF @Index = 42
BEGIN
use QingDao_XiaoJun
goto RunTask
END
ELSE IF @Index = 43
BEGIN
use QingDao_Sweet
goto RunTask
END
ELSE IF @Index = 44
BEGIN
use ZhengZhou_KaKa
goto RunTask
END
ELSE IF @Index = 45
BEGIN
use QingDao_PuXin
goto RunTask
END
ELSE IF @Index = 46
BEGIN
use TaiYuan_ShaXuan_02
goto RunTask
END
ELSE IF @Index = 47
BEGIN
use LinYi_DiFanNi
goto RunTask
END
ELSE IF @Index = 48
BEGIN
use TaiYuan_FaXianTa
goto RunTask
END
ELSE IF @Index = 49
BEGIN
use ZhengZhou_HuiShang
goto RunTask
END
ELSE IF @Index = 50
BEGIN
use DongYing_JiangRenDongCheng
goto RunTask
END
ELSE IF @Index = 51
BEGIN
use ZhuCheng_MuBei
goto RunTask
END
ELSE IF @Index = 52
BEGIN
use TaiYuan_FengGe
goto RunTask
END
ELSE IF @Index = 53
BEGIN
use JiNan_ABiao
goto RunTask
END
ELSE IF @Index = 54
BEGIN
use BaoTou_MeiQiSi
goto RunTask
END
ELSE IF @Index = 55
BEGIN
use JiNan_JinZhi
goto RunTask
END
ELSE IF @Index = 56
BEGIN
use JiNan_ATao
goto RunTask
END
ELSE IF @Index = 57
BEGIN
use QingDao_KeLin
goto RunTask
END
ELSE IF @Index = 58
BEGIN
use JinCheng_NiHaoPiaoLiang
goto RunTask
END
ELSE IF @Index = 59
BEGIN
use QingDao_MingYu
goto RunTask
END
ELSE IF @Index = 60
BEGIN
use QingDao_FengHuangMingLiu
goto RunTask
END
ELSE IF @Index = 61
BEGIN
use QingDao_ManXiu
goto RunTask
END
ELSE IF @Index = 62
BEGIN
use JiNan_Great
goto RunTask
END
ELSE IF @Index = 63
BEGIN
use TaiYuan_ZhouJi
goto RunTask
END
ELSE IF @Index = 64
BEGIN
use ZhengZhou_LiShuangShuang
goto RunTask
END
ELSE IF @Index = 65
BEGIN
use YangQuan_ManDu
goto RunTask
END
ELSE IF @Index = 66
BEGIN
use HuHeHaoTe_YunXin
goto RunTask
END
ELSE IF @Index = 67
BEGIN
use JiNan_ShangPin
goto RunTask
END
ELSE IF @Index = 68
BEGIN
use TaiYuan_XinGanJue
goto RunTask
END
ELSE IF @Index = 69
BEGIN
use WeiFang_RuiLi
goto RunTask
END
ELSE IF @Index = 70
BEGIN
use QingDao_ShaXuan
goto RunTask
END
ELSE IF @Index = 71
BEGIN
use QingDao_ZiRanFaZe
goto RunTask
END
ELSE IF @Index = 72
BEGIN
use QingDao_SiNuoMei
goto RunTask
END
ELSE IF @Index = 73
BEGIN
use QingDao_QiShang
goto RunTask
END
ELSE IF @Index = 74
BEGIN
use YinChuan_TX
goto RunTask
END
ELSE IF @Index = 75
BEGIN
use QingDao_Su
goto RunTask
END
ELSE IF @Index = 76
BEGIN
use QingDao_MeiGe
goto RunTask
END
ELSE IF @Index = 77
BEGIN
use QingDao_ZhuoMeiYiRen
goto RunTask
END
ELSE IF @Index = 78
BEGIN
use JiNan_XiuMuMing
goto RunTask
END
ELSE IF @Index = 79
BEGIN
use JiNan_MeiShang
goto RunTask
END
ELSE IF @Index = 80
BEGIN
use LongKou_NiJing
goto RunTask
END
ELSE IF @Index = 81
BEGIN
use QingDao_HongRenGuan
goto RunTask
END
ELSE IF @Index = 82
BEGIN
use DongYing_MuLanJie
goto RunTask
END
ELSE IF @Index = 83
BEGIN
use QingDao_MaLin
goto RunTask
END
ELSE IF @Index = 84
BEGIN
use QingDao_NiSiKa_JiaoZhou
goto RunTask
END
ELSE IF @Index = 85
BEGIN
use LaiZhou_MangGuo
goto RunTask
END
ELSE IF @Index = 86
BEGIN
use ZhengZhou_AMaNi
goto RunTask
END
ELSE IF @Index = 87
BEGIN
use ZhengZhou_YiPinJianSu
goto RunTask
END
ELSE IF @Index = 88
BEGIN
use JiNan_MingGe
goto RunTask
END
ELSE IF @Index = 89
BEGIN
use HuHeHaoTe_FeiWen
goto RunTask
END
ELSE IF @Index = 90
BEGIN
use LiaoCheng_ShiJiJinDian
goto RunTask
END
ELSE IF @Index = 91
BEGIN
use ZiBo_YanYi
goto RunTask
END
ELSE IF @Index = 92
BEGIN
use ZhengZhou_YiShaLong
goto RunTask
END
ELSE IF @Index = 93
BEGIN
use ZhengZhou_AFang
goto RunTask
END
ELSE IF @Index = 94
BEGIN
use ZhengZhou_JueShiMingJian
goto RunTask
END
ELSE IF @Index = 95
BEGIN
use ZhengZhou_SiYiShaXuan
goto RunTask
END
ELSE IF @Index = 96
BEGIN
use QingDao_PinShang
goto RunTask
END
ELSE IF @Index = 97
BEGIN
use ZhengZhou_GuangPai
goto RunTask
END
ELSE IF @Index = 98
BEGIN
use QingDao_GuBeiShaLong
goto RunTask
END
ELSE IF @Index = 99
BEGIN
use QingDao_SouYa
goto RunTask
END
ELSE IF @Index = 100
BEGIN
use ZhengZhou_PiaoLiangBaoBei
goto RunTask
END
ELSE IF @Index = 101
BEGIN
use DongYing_SexyQueen
goto RunTask
END
ELSE IF @Index = 102
BEGIN
use ZhengZhou_JiangRenZuHe
goto RunTask
END
ELSE IF @Index = 103
BEGIN
use ZhengZhou_TianQi
goto RunTask
END
ELSE IF @Index = 104
BEGIN
use QingDao_FuJun
goto RunTask
END
ELSE IF @Index = 105
BEGIN
use JiNan_AShuangAYue
goto RunTask
END
ELSE IF @Index = 106
BEGIN
use QingDao_MoDengLiShe
goto RunTask
END
ELSE IF @Index = 107
BEGIN
use LSS
goto RunTask
END
ELSE IF @Index = 108
BEGIN
use ZhengZhou_XinYinXiang
goto RunTask
END
ELSE IF @Index = 109
BEGIN
use SaiDao_Temp
goto RunTask
END
ELSE IF @Index = 110
BEGIN
use JinCheng_AGuanDingZhi
goto RunTask
END
ELSE IF @Index = 111
BEGIN
use SaiDao_ChongQing
goto RunTask
END
ELSE IF @Index = 112
BEGIN
use WuHan_Demo1
goto RunTask
END
ELSE IF @Index = 113
BEGIN
use LFPR
goto RunTask
END
ELSE IF @Index = 114
BEGIN
use ZhengZhou_LiShuangShuang_TaiNeng
goto RunTask
END
PRINT 'END'