Article ID: 176493
Article Last Modified on 3/14/2006
APPLIES TO
- Microsoft SQL Server 6.5 Standard Edition
This article was previously published under Q176493
BUG #: 17418 (SQLBUG_65)
SYMPTOMS
A handled access violation (AV) may occur if all of the following conditions are true:
- A query references a view.
- The view contains a join.
- The query contains a subselect.
- SET FORCEPLAN ON was run before the query.
If all of these conditions are true, a DB-Library client may receive the following error:
An ODBC client may receive the following error:
You may see in the SQL Server error log messages similar to the following:
EXCEPTION_ACCESS_VIOLATION raised, attempting to create symptom dump Initializing symptom dump and stack dump facilities ***BEGIN STACK TRACE*** 0x0042F2C8 in sqlservr.EXE, newlinklock() + 0x0418 0x00433717 in sqlservr.EXE, opendb() + 0x00F7 0x0042ED45 in sqlservr.EXE, check_deadlock() + 0x0675 0x0042EFA8 in sqlservr.EXE, newlinklock() + 0x00F8 0x00423B50 in sqlservr.EXE, dbswriteflush() + 0x0160 0x004229BD in sqlservr.EXE, dbswritecheck() + 0x07AD 0x0040E680 in sqlservr.EXE, ksconsole() + 0x0320 0x0040F1E5 in sqlservr.EXE, initcfgfix() + 0x03D5 0x0040ED45 in sqlservr.EXE, initconfig() + 0x0165 0x0040B7B2 in sqlservr.EXE, SqlDumpLocks() + 0x0052 0x00415217 in sqlservr.EXE, udasyncwrite() + 0x0187
WORKAROUND
To work around this problem, do either of the following:
- Do not use SET FORCEPLAN ON for the query.
-or-
- Change the query to avoid one of the other causes. For the most part, you can do this by using a join instead of a subselect.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 6.5. This problem has been corrected in Service Pack 5a for Microsoft SQL Server 6.5.For more information, click the following article number to view the article in the Microsoft Knowledge Base:
197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a
For more information, contact your primary support provider.
MORE INFORMATION
Steps to Reproduce the Problem
Use the following to create the view:
use pubs go create view v1 AS select ta.title_id, t.pub_id from titleauthor ta inner join titles t on t.title_id = ta.title_id
Use the following query to cause an access violation:
set forceplan on select distinct * from v1 where pub_id in (select pub_id from publishers) set forceplan off
The following query demonstrates the workaround:
set forceplan on select distinct v1.* from v1 inner join publishers p on v1.pub_id=p.pub_id set forceplan off
Additional query words: joinorder join order exception
Keywords: kbbug kbfix kbusage KB176493