Microsoft KB Archive/316203

= BUG: INSERT of RESTORE HEADERONLY Results into Temp Table May Generate an Access Violation =

Article ID: 316203

Article Last Modified on 6/27/2002

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q316203



BUG #: 102225 (SQLBUG_70)



SYMPTOMS
If you execute an INSERT of a RESTORE HEADERONLY result into a temporary table, a handled Access Violation (AV) occurs if you incorrectly define the temporary table.



CAUSE
At least one of the columns in the table you defined is too small for the data returned by the EXECUTE statement.



WORKAROUND
To work around this problem, refer to the &quot;Results Sets&quot; heading of the &quot;RESTORE HEADERONLY&quot; topic in SQL Server 7.0 Books Online for the original column definition.



STATUS
Microsoft has confirmed that this is a problem in SQL Server 7.0.



MORE INFORMATION
The following example causes the Access Violation: create table #temp (   bn varchar(100), bd varchar(100), bt varchar(1), ed varchar(10),    c varchar(2), P varchar(2), DT varchar(2), UN varchar(10),     SN varchar(12), DN varchar(40), DV varchar(4), DCD datetime,      BS varchar(10), FL varchar(20), LL varchar(20), CL varchar(20),     DBL varchar(20), BSD datetime, BkupFDte datetime, SO varchar(3),    CP varchar(2), ULI varchar(5), UCS varchar(10), CL2 varchar(3),    SVI varchar(5), SVM varchar(3), SVMi varchar(3), SVB varchar(4),    MN varchar(100))

declare @a varchar(128) select @a='restore headeronly from disk= D:\MSSQL7\BACKUP\pubs.bak' select @a

insert #temp exec (@a)

select * from #temp drop table #temp This is the stack trace from Microsoft SQL Server 7.0 Service Pack 3 (SP3), which you can see in the SQL Server error log: Short Stack Dump 0x00410c2d Module(sqlservr+10c2d) (CVariableInfo::CVarBlock::PvbJoin+55) 0x00410b3f Module(sqlservr+10b3f) (CVariableInfo::PviRelease+60) 0x00410adb Module(sqlservr+10adb) (CVarPageMgr::Release+13) 0x00410ac5 Module(sqlservr+10ac5) (CMemObj::Free+1c) 0x00410481 Module(sqlservr+10481) (CMemThread::Free+1e) 0x00410a99 Module(sqlservr+10a99) (operator delete+1a) 0x00793a75 Module(sqlservr+393a75) (BackupResultSet::~BackupResultSet+be) 0x0072bc51 Module(sqlservr+32bc51) (BackupOperation::Close+4b5) 0x0072b79d Module(sqlservr+32b79d) (BackupOperation::~BackupOperation+54) 0x007929eb Module(sqlservr+3929eb) (CPtr::Delete+10) 0x0070fbb0 Module(sqlservr+30fbb0) (BackupEntry::DescribeMedia+f3) 0x0060922e Module(sqlservr+20922e) (CStmtLoadVol::XretExecute+6f) 0x004145f1 Module(sqlservr+145f1) (CMsqlExecContext::ExecuteStmts+11a) 0x0041409f Module(sqlservr+1409f) (CMsqlExecContext::Execute+16a) The correct behavior is to generate this error message, and then terminate the statement:

Server: Msg 8152, Level 16, State 2, Line 1 String or binary data would be truncated. Server: Msg 3013, Level 16, State 1, Line 1 RESTORE HEADERONLY is terminating abnormally.

Keywords: kbbug kbpending KB316203

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.