我正在尝试将SQL BAK文件中的标头信息解析为表格,但是我收到以下错误。
Msg 206,Level 16,State 2,Line 1 操作数类型冲突:uniqueidentifier与数字不兼容 Msg 3013,Level 16,State 1,Line 1 RESTORE FILELIST异常终止。
这是我写的脚本,但我不明白为什么会收到此错误。
DECLARE @ HeaderInfo2表
(LogicalName nvarchar(128),
PhysicalName nvarchar(128),
Type nvarchar(128),
FileGroupName nvarchar(128),
Size numeric(25,0),
MaxSize numeric(25,0),
FileId int,
CreateLSN int,
DropLSN int,
UniqueId uniqueidentifier ,
ReadOnlyLSN int,
ReadWriteLSN int,
BackupSizeInBytes numeric(25,0),
SourceBlockSize numeric(25,0),
FileGroupId int,
LogGroupGUID numeric(25,0),
DifferentialBaseLSN numeric(25,0),
DifferentialBaseGUID numeric(25,0),
IsReadOnly int,
IsPresent int,
TDEThumbprint int
)
INSERT INTO @ HeaderInfo2 EXEC(' RESTORE FILELISTONLY 来自DISK = N'我:\ DBTemp \ database.bak'' 与NOUNLOAD')
答案 0 :(得分:0)
您的数据类型不正确。可以找到正确的数据类型here:
Column name Data type
LogicalName nvarchar(128)
PhysicalName nvarchar(260)
Type char(1)
FileGroupName nvarchar(128)
Size numeric(20,0)
MaxSize numeric(20,0)
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
TDEThumbprint varbinary(32)