/************************************************************************/ /* 程序编写: Jeff 版 本: V 1.0 建立日期: 2015-06-02 功能说明: 从备份中恢复订单数据; 备 注: 修改日期: 修改说明: */ /************************************************************************/ select * from client where id = '20130809-027' select * from dindan where id = '20130809-027' select * from dindanjd where id = '20130809-027' select * from dindansp where id = '20130809-027' select * from dindansp2 where id = '20130809-027' select * from dindansp3 where id = '20130809-027' select * from dindanbukuan where id = '20130809-027' select * from dindanbukuan2 where id = '20130809-027' select * from burncdreg where id = '20130809-027' select * from digitalwork where id = '20130809-027' select * from mywork where id = '20130809-027' select * from photoprint where id = '20130809-027' DECLARE @bak_db nvarchar(50) -- 备份的数据库; DECLARE @cur_db nvarchar(50) -- 当前的数据库; DECLARE @count int -- 指定订单数量; set @bak_db = '2012' set @cur_db = 'db' insert into [bak].[dbo].[client] select * from [db].[dbo].[client] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindan] select * from [db].[dbo].[dindan] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindanjd] select * from [db].[dbo].[dindanjd] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindansp]([id],[spid],[shuliang],[kind],[price] ,[name],[no],[status1],[status2],[status3] ,[status4],[date1],[date2],[date3],[date4],[name1] ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent] ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5] ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] ) select [id],[spid],[shuliang],[kind],[price] ,[name],[no],[status1],[status2],[status3] ,[status4],[date1],[date2],[date3],[date4],[name1] ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent] ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5] ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] from [db].[dbo].[dindansp] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindansp2] select * from [db].[dbo].[dindansp2] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindansp3] select * from [db].[dbo].[dindansp3] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindanbukuan]([id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck],[discount],[time]) select [id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck],[discount],[time] from [db].[dbo].[dindanbukuan] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[dindanbukuan2]([id],[money],[ren],[date],[bz],[kind],[ren2]) select [id],[money],[ren],[date],[bz],[kind],[ren2] from [db].[dbo].[dindanbukuan2] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[burncdreg] select * from [db].[dbo].[burncdreg] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[digitalwork] select * from [db].[dbo].[digitalwork] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[mywork] select * from [db].[dbo].[mywork] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) insert into [bak].[dbo].[photoprint] select * from [db].[dbo].[photoprint] where id in( '20150302-012','20150310-021', '20150312-029','20150327-022', '20150327-023','20150327-024', '20150328-034','20150328-035', '20150328-036','20150328-037', '20150328-038','20150328-039', '20150328-040','20150328-043', '20150328-047','20150328-048', '20150328-049','20150329-020', '20150329-112','20150513-002', '20150513-008','20150513-009', '20150513-010','20150513-011', '20150513-012','20150513-013', '20150513-018','20150514-002', '20150514-007','20150514-008', '20150514-009','20150514-010' ) /* insert into [db].[dbo].[client] select * from [2013].[dbo].[client] where id = '20130725-008' insert into [db].[dbo].[dindan] select * from [2013].[dbo].[dindan] where id = '20130725-008' insert into [db].[dbo].[dindanjd] select * from [2013].[dbo].[dindanjd] where id = '20130725-008' insert into [db].[dbo].[dindansp]([id],[spid],[shuliang],[kind],[price] ,[name],[no],[status1],[status2],[status3] ,[status4],[date1],[date2],[date3],[date4],[name1] ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent] ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5] ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] ) select [id],[spid],[shuliang],[kind],[price] ,[name],[no],[status1],[status2],[status3] ,[status4],[date1],[date2],[date3],[date4],[name1] ,[name2],[name3],[name4],[hqdate],[hqtime],[urgent] ,[taketime],[no2],[status5],[status6],[date5],[date6],[name5] ,[name6],[growthtxname],[ps],[zs],[ren1],[ren2],[hqstatus],[bz] from [2013].[dbo].[dindansp] where id = '20130725-008' insert into [db].[dbo].[dindansp2] select * from [2013].[dbo].[dindansp2] where id = '20130725-008' insert into [db].[dbo].[dindansp3] select * from [2013].[dbo].[dindansp3] where id = '20130725-008' insert into [db].[dbo].[dindanbukuan]([id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck],[discount],[time]) select [id],[money],[ren],[date],[bz],[kind],[ren2],[item],[paytype],[jdd],[financecheck],[discount],[time] from [2013].[dbo].[dindanbukuan] where id = '20130725-008' insert into [db].[dbo].[dindanbukuan2]([id],[money],[ren],[date],[bz],[kind],[ren2]) select [id],[money],[ren],[date],[bz],[kind],[ren2] from [2013].[dbo].[dindanbukuan2] where id = '20130725-008' insert into [db].[dbo].[burncdreg] select * from [2013].[dbo].[burncdreg] where id = '20130725-008' insert into [db].[dbo].[digitalwork] select * from [2013].[dbo].[digitalwork] where id = '20130725-008' insert into [db].[dbo].[mywork] select * from [2013].[dbo].[mywork] where id = '20130725-008' insert into [db].[dbo].[photoprint] select * from [2013].[dbo].[photoprint] where id ='20130725-008' */