首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

紧急求解-navicat恢复有关问题

2012-08-17 
紧急求解----navicat恢复问题刚才不小心把navicat中的一个表删除(很重要的表),求恢复方法啊?连接的是sql s

紧急求解----navicat恢复问题
刚才不小心把navicat中的一个表删除(很重要的表),求恢复方法啊?连接的是sql server 2008 r2版本的数据库----着急

[解决办法]

SQL code
--> 测试数据:[test]if object_id('[test]') is not null drop table [test]create table [test]([C_ID] int,[part] int,[type] int,[data] varchar(10),[CSN_UpdateTime] datetime)insert [test]select 1,0,1,'xxxxxxxxxx','2012-5-11 17:59:08' union allselect 1,0,2,'xxxxxxx','2012-5-11 17:59:13' union allselect 1,1,1,'xxxxxxx','2012-5-11 17:59:13' union allselect 1,1,2,'xxxxxx','2012-5-11 17:59:13' union allselect 1,2,1,'xxxxxx','2012-5-11 17:59:13' union allselect 1,2,2,'xxxxxx','2012-5-11 17:59:13' union allselect 1,0,1,'xxxxxxxxxx','2012-5-11 18:00:18' union allselect 1,0,2,'xxxxxxx','2012-5-11 18:00:18' union allselect 1,1,1,'xxxxxxx','2012-5-11 18:00:18' union allselect 1,1,2,'xxxxxx','2012-5-11 18:00:18' union allselect 1,2,1,'xxxxxx','2012-5-11 18:00:18' union allselect 1,2,2,'xxxxxx','2012-5-11 18:00:18';with tas(select [C_ID],[part],[data],px=ROW_NUMBER()over(partition by part order by getdate())from test a where a.CSN_UpdateTime=(select MAX(b.CSN_UpdateTime) from test bwhere a.C_ID=b.C_ID and a.part=b.part and a.[type]=b.[type]))select t.C_ID,t.part,min(t.data) as data1,max(m.data) as data2 fromt inner joint m on t.C_ID=m.C_ID and t.part=m.part and t.px=m.pxwhere t.C_ID=1group by t.C_ID,t.part/*C_ID    part    data1    data21    0    xxxxxxx    xxxxxxxxxx1    1    xxxxxx    xxxxxxx1    2    xxxxxx    xxxxxx*/
[解决办法]
探讨

SQL code

--> 测试数据:[test]
if object_id('[test]') is not null
drop table [test]
create table [test](
[C_ID] int,
[part] int,
[type] int,
[data] varchar(10),
[CSN_UpdateTime] datetime
)
insert [test]……

热点排行