打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
SQL restore filelistonly 问题
SQL code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--这个命令最多只能with file=XX
--可以将输出结果导入一个临时表中,之后就自由的进行各种操作了
create table #filelistinfo
(
    LogicalName nvarchar(128) null,
    PhysicalName nvarchar(260) null,
    Type char(1) null,
    FileGroupName nvarchar(128) null,
    FileSize bigint null ,
    FileMaxSize Bigint null,
    FileId bigint,
    CreateLSN numeric(25,0),
    DropLSN numeric(25,0) NULL,
    UniqueID uniqueidentifier,
    ReadOnlyLSN numeric(25,0) NULL,
    ReadWriteLSN numeric(25,0) NULL,
    BackupSizeInBytes bigint,
    SourceBlockSize int,
    FileGroupID int,
    LogGroupGUID uniqueidentifier NULL,
    DifferentialBaseLSN numeric(25,0) NULL,
    DifferentialBaseGUID uniqueidentifier,
    IsReadOnly bit,
    IsPresent bit
)
declare @filelistSQL varchar(8000)
set @filelistSQL = 'restore filelistonly from disk=''D:\123.bak''' 
insert into #filelistinfo exec(@filelistSQL)

注:临时表的结构要和restore filelistonly 命令的输出结果集相同,可能在不同的SQL版本下有所差异,注意自行调整
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
RESTORE FILELISTONLY (Transact
使用SQL BAK Reader 小工具查看SQL Server备份文件内容(不需要打开SQL Server)
SQL Server:用 SQL 语句还原数据库(with move 选项用法)
SQL 分组后只获取每组的一条数据
从文本批量导入数据导SQL Server数据表
sqlserver与java数据类型对应
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服