singleincome与singleincomemoney.sql 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. --1.[singleincome]
  2. --将2014中的singleincome记录插入回db数据库中;
  3. set IDENTITY_INSERT [db].[dbo].[singleincome] ON
  4. insert into [db].[dbo].[singleincome]
  5. ([id]
  6. ,[name]
  7. ,[money]
  8. ,[dat]
  9. ,[bz]
  10. ,[renyuan1]
  11. ,[renyuan2]
  12. ,[renyuan3]
  13. ,[sale2type]
  14. ,[paytype]
  15. ,[phone]
  16. ,[payed]
  17. ,[balance]
  18. ,[pinyin]
  19. ,[financecheck]
  20. ,[count]
  21. ,[time]) select * from [2014].[dbo].[singleincome]
  22. where not exists(select id from [db].[dbo].[singleincome] where [db].[dbo].[singleincome].[id] = [2014].[dbo].[singleincome].[id])
  23. set IDENTITY_INSERT [db].[dbo].[singleincome] OFF
  24. --2.[singleincomemoney]
  25. --将2014中的singleincomemoney记录插入回db数据库中;
  26. insert into [db].[dbo].[singleincomemoney]([id],[money],[date],[clerk],[paytype],[financecheck],[time],[jdd])
  27. select [id],[money],[date],[clerk],[paytype],[financecheck],[time],[jdd]
  28. from [2014].[dbo].[singleincomemoney]
  29. where not exists(select id from [db].[dbo].[singleincomemoney] where [db].[dbo].[singleincomemoney].[id] = [2014].[dbo].[singleincomemoney].[id])