singleincome与singleincomemoney.sql 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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]
  22. ,[jdd]) select * from [2014].[dbo].[singleincome]
  23. where not exists(select id from [db].[dbo].[singleincome] where [db].[dbo].[singleincome].[id] = [2014].[dbo].[singleincome].[id])
  24. set IDENTITY_INSERT [db].[dbo].[singleincome] OFF
  25. --2.[singleincomemoney]
  26. --将2014中的singleincomemoney记录插入回db数据库中;
  27. insert into [db].[dbo].[singleincomemoney]([id],[money],[date],[clerk],[paytype],[financecheck],[time],[jdd])
  28. select [id],[money],[date],[clerk],[paytype],[financecheck],[time],[jdd]
  29. from [2014].[dbo].[singleincomemoney]
  30. where not exists(select id from [db].[dbo].[singleincomemoney] where [db].[dbo].[singleincomemoney].[id] = [2014].[dbo].[singleincomemoney].[id])