转历史数据Ver3.sql 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. --将2014订单中的数据转回;
  2. --1.dindan;
  3. insert [db].[dbo].[dindan]
  4. ([id]
  5. ,[money1]
  6. ,[money2]
  7. ,[money3]
  8. ,[name1]
  9. ,[name2]
  10. ,[taoxiid]
  11. ,[taoxiname]
  12. ,[taoxijiage]
  13. ,[taoxizs]
  14. ,[time1]
  15. ,[time2]
  16. ,[time3]
  17. ,[bm]
  18. ,[ren]
  19. ,[discount]
  20. ,[payed1]
  21. ,[payed2]
  22. ,[payed3]
  23. ,[payed4]
  24. ,[payed5]
  25. ,[time4]
  26. ,[time5]
  27. ,[takezs]
  28. ,[choosezs]
  29. ,[status]
  30. ,[clothescount2]
  31. ,[outside2]
  32. ,[style]
  33. ,[payed3time]
  34. ,[payed4ren]
  35. ,[payed4time]
  36. ,[status2]
  37. ,[status3]
  38. ,[waiter1]
  39. ,[waiter2]
  40. ,[waiter3]
  41. ,[waiter4]
  42. ,[bz]
  43. ,[taketime]
  44. ,[clothescount]
  45. ,[outside]
  46. ,[bz2]
  47. ,[bz3]
  48. ,[urgent]
  49. ,[status4]
  50. ,[status5]
  51. ,[waiter5]
  52. ,[waiter6]
  53. ,[pinyin1]
  54. ,[pinyin2]
  55. ,[waiter7]
  56. ,[status6]
  57. ,[phone1]
  58. ,[phone2]
  59. ,[status7]
  60. ,[memberno]
  61. ,[waiter8]
  62. ,[time6]
  63. ,[status8]
  64. ,[bruncount]
  65. ,[tichenren1]
  66. ,[tichenren2]
  67. ,[tichenren3]
  68. ,[tichenren4]
  69. ,[tichenren5]
  70. ,[send1]
  71. ,[send2]
  72. ,[send3]
  73. ,[datetime4]
  74. ,[datetime5]
  75. ,[datetime6]
  76. ,[waiter12]
  77. ,[waiter13]
  78. ,[waiter14]
  79. ,[waiter22]
  80. ,[waiter23]
  81. ,[waiter24]
  82. ,[waiter1rate]
  83. ,[waiter12rate]
  84. ,[waiter13rate]
  85. ,[waiter14rate]
  86. ,[waiter2rate]
  87. ,[waiter22rate]
  88. ,[waiter23rate]
  89. ,[waiter24rate]
  90. ,[ren2]
  91. ,[renrate]
  92. ,[ren2rate]
  93. ,[delphotos]
  94. ,[delphotos2]
  95. ,[txtype]
  96. ,[growthtxselname]
  97. ,[designno]
  98. ,[designreplaceno]
  99. ,[size]
  100. ,[dindantype]
  101. ,[contractno1]
  102. ,[contractno2]
  103. ,[cfno]
  104. ,[calldate]
  105. ,[from]
  106. ,[reason]
  107. ,[time7]
  108. ,[time8]
  109. ,[time9]
  110. ,[time10]
  111. ,[authorize]
  112. ,[discount2]
  113. ,[authorize2]
  114. ,[bz4]
  115. ,[satisfaction1]
  116. ,[satisfaction2]
  117. ,[satisfaction3]
  118. ,[satisfaction4]
  119. ,[satisfaction5]
  120. ,[satisfaction6]
  121. ,[satisfaction7]
  122. ,[bz5]
  123. ,[send4]
  124. ,[send5]
  125. ,[waiter9]
  126. ,[curno]
  127. ,[xplrr]
  128. ,[xplrtime]
  129. ,[satisfaction8]
  130. ,[VisitPeople1]
  131. ,[VisitPeople2]
  132. ,[VisitPeople3]
  133. ,[VisitPeople4]
  134. ,[VisitPeople5]
  135. ,[VisitPeople6]
  136. ,[VisitPeople7]
  137. ,[VisitPeople8]
  138. ,[VisitTime1]
  139. ,[VisitTime2]
  140. ,[VisitTime3]
  141. ,[VisitTime4]
  142. ,[VisitTime5]
  143. ,[VisitTime6]
  144. ,[VisitTime7]
  145. ,[VisitTime8])
  146. select [id]
  147. ,[money1]
  148. ,[money2]
  149. ,[money3]
  150. ,[name1]
  151. ,[name2]
  152. ,[taoxiid]
  153. ,[taoxiname]
  154. ,[taoxijiage]
  155. ,[taoxizs]
  156. ,[time1]
  157. ,[time2]
  158. ,[time3]
  159. ,[bm]
  160. ,[ren]
  161. ,[discount]
  162. ,[payed1]
  163. ,[payed2]
  164. ,[payed3]
  165. ,[payed4]
  166. ,[payed5]
  167. ,[time4]
  168. ,[time5]
  169. ,[takezs]
  170. ,[choosezs]
  171. ,[status]
  172. ,[clothescount2]
  173. ,[outside2]
  174. ,[style]
  175. ,[payed3time]
  176. ,[payed4ren]
  177. ,[payed4time]
  178. ,[status2]
  179. ,[status3]
  180. ,[waiter1]
  181. ,[waiter2]
  182. ,[waiter3]
  183. ,[waiter4]
  184. ,[bz]
  185. ,[taketime]
  186. ,[clothescount]
  187. ,[outside]
  188. ,[bz2]
  189. ,[bz3]
  190. ,[urgent]
  191. ,[status4]
  192. ,[status5]
  193. ,[waiter5]
  194. ,[waiter6]
  195. ,[pinyin1]
  196. ,[pinyin2]
  197. ,[waiter7]
  198. ,[status6]
  199. ,[phone1]
  200. ,[phone2]
  201. ,[status7]
  202. ,[memberno]
  203. ,[waiter8]
  204. ,[time6]
  205. ,[status8]
  206. ,[bruncount]
  207. ,[tichenren1]
  208. ,[tichenren2]
  209. ,[tichenren3]
  210. ,[tichenren4]
  211. ,[tichenren5]
  212. ,[send1]
  213. ,[send2]
  214. ,[send3]
  215. ,[datetime4]
  216. ,[datetime5]
  217. ,[datetime6]
  218. ,[waiter12]
  219. ,[waiter13]
  220. ,[waiter14]
  221. ,[waiter22]
  222. ,[waiter23]
  223. ,[waiter24]
  224. ,[waiter1rate]
  225. ,[waiter12rate]
  226. ,[waiter13rate]
  227. ,[waiter14rate]
  228. ,[waiter2rate]
  229. ,[waiter22rate]
  230. ,[waiter23rate]
  231. ,[waiter24rate]
  232. ,[ren2]
  233. ,[renrate]
  234. ,[ren2rate]
  235. ,[delphotos]
  236. ,[delphotos2]
  237. ,[txtype]
  238. ,[growthtxselname]
  239. ,[designno]
  240. ,[designreplaceno]
  241. ,[size]
  242. ,[dindantype]
  243. ,[contractno1]
  244. ,[contractno2]
  245. ,[cfno]
  246. ,[calldate]
  247. ,[from]
  248. ,[reason]
  249. ,[time7]
  250. ,[time8]
  251. ,[time9]
  252. ,[time10]
  253. ,[authorize]
  254. ,[discount2]
  255. ,[authorize2]
  256. ,[bz4]
  257. ,[satisfaction1]
  258. ,[satisfaction2]
  259. ,[satisfaction3]
  260. ,[satisfaction4]
  261. ,[satisfaction5]
  262. ,[satisfaction6]
  263. ,[satisfaction7]
  264. ,[bz5]
  265. ,[send4]
  266. ,[send5]
  267. ,[waiter9]
  268. ,[curno]
  269. ,[xplrr]
  270. ,[xplrtime]
  271. ,[satisfaction8]
  272. ,[VisitPeople1]
  273. ,[VisitPeople2]
  274. ,[VisitPeople3]
  275. ,[VisitPeople4]
  276. ,[VisitPeople5]
  277. ,[VisitPeople6]
  278. ,[VisitPeople7]
  279. ,[VisitPeople8]
  280. ,[VisitTime1]
  281. ,[VisitTime2]
  282. ,[VisitTime3]
  283. ,[VisitTime4]
  284. ,[VisitTime5]
  285. ,[VisitTime6]
  286. ,[VisitTime7]
  287. ,[VisitTime8]
  288. from [2014].[dbo].[dindan]
  289. where [2014].[dbo].[dindan].[id] not in(select id from [db].[dbo].[dindan])
  290. go
  291. --0.备份当前db的dindansp表到dindansp_back
  292. select [id],[spid],[shuliang],[kind],[price]
  293. ,[name],[no],[status1],[status2],[status3]
  294. ,[status4],[date1],[date2],[date3],[date4],[name1]
  295. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  296. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  297. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz]
  298. into [db].[dbo].[dindansp_back] from [db].[dbo].[dindansp]
  299. --1.将2014和db的dindnasp表的全部记录插入到#tempall中;
  300. select [id],[spid],[shuliang],[kind],[price]
  301. ,[name],[no],[status1],[status2],[status3]
  302. ,[status4],[date1],[date2],[date3],[date4],[name1]
  303. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  304. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  305. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz]
  306. into #tempall from [db].[dbo].[dindansp]
  307. go
  308. insert into #tempall
  309. select [id],[spid],[shuliang],[kind],[price]
  310. ,[name],[no],[status1],[status2],[status3]
  311. ,[status4],[date1],[date2],[date3],[date4],[name1]
  312. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  313. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  314. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz]
  315. from [2014].[dbo].[dindansp]
  316. --2.过滤掉#tempall中完全重复的记录到#tempdis中;
  317. go
  318. select distinct * into #tempdis from #tempall
  319. go
  320. drop table #tempall
  321. go
  322. --3.获取指定字段的不重复记录,过滤掉不完全重复的记录;
  323. select identity(int,1,1) as autoid, * into #temp1 from #tempdis
  324. select min(autoid) as autoid into #temp2 from #temp1 group by [id],[spid],[name],[no]
  325. select [id],[spid],[shuliang],[kind],[price]
  326. ,[name],[no],[status1],[status2],[status3]
  327. ,[status4],[date1],[date2],[date3],[date4],[name1]
  328. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  329. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  330. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz]
  331. into dindansp# from #temp1 where autoid in(select autoid from #temp2) order by id
  332. go
  333. --4.将过滤好的记录重新插入原表;
  334. drop table [db].[dbo].[dindansp]
  335. GO
  336. use [db]
  337. CREATE TABLE [dbo].[dindansp](
  338. [id] [nvarchar](50) NULL,
  339. [spid] [nvarchar](50) NULL,
  340. [shuliang] [nvarchar](120) NULL,
  341. [kind] [nvarchar](10) NULL,
  342. [price] [nvarchar](50) NULL,
  343. [name] [nvarchar](50) NULL,
  344. [no] [nvarchar](max) NULL,
  345. [status1] [nvarchar](50) NULL,
  346. [status2] [nvarchar](50) NULL,
  347. [status3] [nvarchar](50) NULL,
  348. [status4] [nvarchar](50) NULL,
  349. [autoid] [int] IDENTITY(1,1) NOT NULL,
  350. [date1] [nvarchar](50) NULL,
  351. [date2] [nvarchar](50) NULL,
  352. [date3] [nvarchar](50) NULL,
  353. [date4] [nvarchar](50) NULL,
  354. [name1] [nvarchar](50) NULL,
  355. [name2] [nvarchar](50) NULL,
  356. [name3] [nvarchar](50) NULL,
  357. [name4] [nvarchar](50) NULL,
  358. [hqdate] [nvarchar](50) NULL,
  359. [hqtime] [nvarchar](50) NULL,
  360. [urgent] [nvarchar](50) NULL,
  361. [taketime] [nvarchar](50) NULL,
  362. [no2] [nvarchar](max) NULL,
  363. [growthtxname] [nvarchar](50) NULL,
  364. [status5] [nvarchar](50) NULL,
  365. [status6] [nvarchar](50) NULL,
  366. [date5] [nvarchar](50) NULL,
  367. [date6] [nvarchar](50) NULL,
  368. [name5] [nvarchar](50) NULL,
  369. [name6] [nvarchar](50) NULL,
  370. [ps] [nvarchar](50) NULL,
  371. [zs] [nvarchar](50) NULL,
  372. [ren1] [nvarchar](120) NULL,
  373. [ren2] [nvarchar](120) NULL,
  374. [hqstatus] [nvarchar](50) NULL,
  375. [bz] [nvarchar](200) NULL
  376. ) ON [PRIMARY]
  377. GO
  378. go
  379. insert into dindansp([id],[spid],[shuliang],[kind],[price]
  380. ,[name],[no],[status1],[status2],[status3]
  381. ,[status4],[date1],[date2],[date3],[date4],[name1]
  382. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  383. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  384. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] ) select [id],[spid],[shuliang],[kind],[price]
  385. ,[name],[no],[status1],[status2],[status3]
  386. ,[status4],[date1],[date2],[date3],[date4],[name1]
  387. ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent]
  388. ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5]
  389. ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] from dindansp#
  390. go
  391. drop table #tempdis
  392. drop table #temp1
  393. drop table #temp2
  394. drop table dindansp#
  395. go
  396. --5.结束
  397. --3.dindanbukuan表;
  398. go
  399. select [id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck]
  400. into [db].[dbo].[dindanbukuan#]
  401. from [db].[dbo].[dindanbukuan]
  402. go
  403. insert into [db].[dbo].[dindanbukuan#]
  404. select [id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck]
  405. from [2014].[dbo].[dindanbukuan]
  406. go
  407. use db
  408. go
  409. select distinct * into #temp from [db].[dbo].[dindanbukuan#]
  410. go
  411. drop table dindanbukuan#
  412. go
  413. drop table dindanbukuan
  414. go
  415. GO
  416. use [db]
  417. CREATE TABLE [dbo].[dindanbukuan](
  418. [autoid] [int] IDENTITY(1,1) NOT NULL,
  419. [id] [nvarchar](50) NULL,
  420. [money] [nvarchar](50) NULL,
  421. [ren] [nvarchar](50) NULL,
  422. [date] [nvarchar](50) NULL,
  423. [bz] [nvarchar](max) NULL,
  424. [kind] [nvarchar](50) NULL,
  425. [ren2] [nvarchar](50) NULL,
  426. [item] [nvarchar](max) NULL,
  427. [paytype] [nvarchar](50) NULL,
  428. [jdd] [nvarchar](50) NULL,
  429. [financecheck] [nvarchar](10) NULL,
  430. [discount] [nvarchar](50) NULL,
  431. [time] [nvarchar](50) NULL
  432. ) ON [PRIMARY]
  433. GO
  434. go
  435. insert into [db].[dbo].[dindanbukuan] ([id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck]) select [id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck] from #temp
  436. go
  437. drop table #temp
  438. go
  439. --4.dindanbukuan2表;
  440. select [id],[money],[ren],[date],[bz],[kind],[ren2] into [db].[dbo].[dindanbukuan2#]
  441. from [db].[dbo].[dindanbukuan2]
  442. insert into [db].[dbo].[dindanbukuan2#]
  443. select [id],[money],[ren],[date],[bz],[kind],[ren2]
  444. from [2014].[dbo].[dindanbukuan2]
  445. go
  446. select distinct * into #temp from dindanbukuan2#
  447. go
  448. drop table dindanbukuan2#
  449. drop table dindanbukuan2
  450. GO
  451. use [db]
  452. CREATE TABLE [dbo].[dindanbukuan2](
  453. [autoid] [int] IDENTITY(1,1) NOT NULL,
  454. [id] [nvarchar](50) NULL,
  455. [money] [nvarchar](50) NULL,
  456. [ren] [nvarchar](50) NULL,
  457. [date] [nvarchar](50) NULL,
  458. [bz] [nvarchar](500) NULL,
  459. [kind] [nvarchar](50) NULL,
  460. [ren2] [nvarchar](50) NULL
  461. ) ON [PRIMARY]
  462. GO
  463. go
  464. insert into [db].[dbo].[dindanbukuan2]([id],[money],[ren],[date],[bz],[kind],[ren2]) select [id],[money],[ren],[date],[bz],[kind],[ren2] from #temp
  465. go
  466. drop table #temp
  467. go
  468. --5.photoprint表;
  469. --insert into [db].[dbo].[photoprint] select * from [2014].[dbo].[photoprint]
  470. --where not exists(select id from [db].[dbo].[photoprint] where [db].[dbo].[photoprint].[id] = [2014].[dbo].[photoprint].[id])
  471. --6.client表;
  472. insert into [db].[dbo].[client] select * from [2014].[dbo].[client]
  473. where not exists(select id from [db].[dbo].[client] where [db].[dbo].[client].[id] = [2014].[dbo].[client].[id])
  474. --7.burncdreg表;
  475. insert into [db].[dbo].[burncdreg] select * from [2014].[dbo].[burncdreg]
  476. where not exists(select id from [db].[dbo].[burncdreg] where [db].[dbo].[burncdreg].[id] = [2014].[dbo].[burncdreg].[id])
  477. --8.digitalwork表;
  478. insert into [db].[dbo].[digitalwork] select * from [2014].[dbo].[digitalwork]
  479. where not exists(select id from [db].[dbo].[digitalwork] where [db].[dbo].[digitalwork].[id] = [2014].[dbo].[digitalwork].[id])
  480. --9.mywork;
  481. insert into [db].[dbo].[mywork] select * from [2014].[dbo].[mywork]
  482. where not exists(select id from [db].[dbo].[mywork] where [db].[dbo].[mywork].[id] = [2014].[dbo].[mywork].[id])
  483. --10.dindanjd表;
  484. --0.备份当前db的dindanjd表到dindanjd_back中;
  485. select * into [db].[dbo].[dindanjd_back] from [db].[dbo].[dindanjd]
  486. --1.将2014和db的dindanjd表全部记录插入到#tempall表中;
  487. select * into #tempall from [2014].[dbo].[dindanjd]
  488. insert into #tempall select * from [db].[dbo].[dindanjd]
  489. --2.过滤掉完全重复的记录;
  490. go
  491. select distinct * into #tempdis from #tempall
  492. go
  493. drop table #tempall
  494. go
  495. --3.获取指定字段的不重复记录,过滤掉不完全重复的记录;
  496. select identity(int,1,1) as autoid, * into #temp1 from #tempdis
  497. select min(autoid) as autoid into #temp2 from #temp1 group by id,name
  498. select [id],[name],[date],[time],[waiter1],[waiter2],[status],[waiter12],[waiter22],[bookingdate],[dress],[bz],[clerk],[inputtime],[branch]
  499. into dindanjd# from #temp1 where autoid in(select autoid from #temp2) order by id
  500. go
  501. --4.将过滤好的记录重新插入原表;
  502. drop table #tempdis
  503. drop table #temp1
  504. drop table #temp2
  505. truncate table dindanjd
  506. insert into dindanjd select * from dindanjd#
  507. drop table dindanjd#
  508. go
  509. --5.结束;
  510. --11.dindansp2表;
  511. select * into [db].[dbo].[dindansp2#] from [db].[dbo].[dindansp2]
  512. insert into [db].[dbo].[dindansp2#] select * from [2014].[dbo].[dindansp2]
  513. go
  514. select distinct * into #temp from dindansp2#
  515. go
  516. drop table dindansp2#
  517. drop table dindansp2
  518. GO
  519. use [db]
  520. CREATE TABLE [dbo].[dindansp2](
  521. [id] [nvarchar](50) NULL,
  522. [name] [nvarchar](50) NULL,
  523. [count] [nvarchar](50) NULL,
  524. [date] [nvarchar](50) NULL,
  525. [clerk] [nvarchar](50) NULL
  526. ) ON [PRIMARY]
  527. GO
  528. go
  529. insert into dindansp2 select * from #temp
  530. go
  531. drop table #temp
  532. go
  533. --12.dindansp3表;
  534. select * into [db].[dbo].[dindansp3#] from [db].[dbo].[dindansp3]
  535. insert into [db].[dbo].[dindansp3#] select * from [2014].[dbo].[dindansp3]
  536. go
  537. select distinct * into #temp from dindansp3#
  538. go
  539. drop table dindansp3#
  540. drop table dindansp3
  541. GO
  542. use [db]
  543. CREATE TABLE [dbo].[dindansp3](
  544. [id] [nvarchar](50) NULL,
  545. [spid] [nvarchar](50) NULL,
  546. [name] [nvarchar](50) NULL,
  547. [count] [nvarchar](50) NULL
  548. ) ON [PRIMARY]
  549. GO
  550. go
  551. insert into dindansp3 select * from #temp
  552. go
  553. drop table #temp
  554. go
  555. --13.[gudingfeiyong]
  556. set IDENTITY_INSERT [db].[dbo].[gudingfeiyong] ON
  557. INSERT INTO [db].[dbo].[gudingfeiyong]
  558. ([id]
  559. ,[name]
  560. ,[money]
  561. ,[dat]
  562. ,[bz]
  563. ,[renyuan1]
  564. ,[renyuan2]
  565. ,[financecheck]
  566. ,[time]
  567. ,[photo]
  568. ,[financecheck2]
  569. ,[financecheck3]
  570. ,[hasphoto]) select * from [2014].[dbo].[gudingfeiyong]
  571. where not exists(select id from [db].[dbo].[gudingfeiyong] where [db].[dbo].[gudingfeiyong].[id] = [2014].[dbo].[gudingfeiyong].[id])
  572. set IDENTITY_INSERT [db].[dbo].[gudingfeiyong] OFF
  573. --14.[singleincome]
  574. set IDENTITY_INSERT [db].[dbo].[singleincome] ON
  575. insert into [db].[dbo].[singleincome]
  576. ([id]
  577. ,[name]
  578. ,[money]
  579. ,[dat]
  580. ,[bz]
  581. ,[renyuan1]
  582. ,[renyuan2]
  583. ,[renyuan3]
  584. ,[sale2type]
  585. ,[paytype]
  586. ,[phone]
  587. ,[payed]
  588. ,[balance]
  589. ,[pinyin]
  590. ,[financecheck]
  591. ,[count]
  592. ,[time]) select * from [2014].[dbo].[singleincome]
  593. where not exists(select id from [db].[dbo].[singleincome] where [db].[dbo].[singleincome].[id] = [2014].[dbo].[singleincome].[id])
  594. set IDENTITY_INSERT [db].[dbo].[singleincome] OFF
  595. --15.[singleincomemoney]
  596. set IDENTITY_INSERT [db].[dbo].[singleincomemoney] ON
  597. insert into [db].[dbo].[singleincomemoney]
  598. ([id]
  599. ,[money]
  600. ,[date]
  601. ,[clerk]
  602. ,[paytype]
  603. ,[autoid]
  604. ,[financecheck]
  605. ,[time]
  606. ,[jdd]) select * from [2014].[dbo].[singleincomemoney]
  607. where not exists(select id from [db].[dbo].[singleincomemoney] where [db].[dbo].[singleincomemoney].[id] = [2014].[dbo].[singleincomemoney].[id])
  608. set IDENTITY_INSERT [db].[dbo].[singleincomemoney] OFF