Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: "SQLSTATE:07001 SQLCODE: -313" Error Message When Using tablename.* Syntax in a Parameterized Query


View products that this article applies to.

Symptoms

If you try to use tablename.* syntax in a parameterized query with the OLE DB Provider for DB2 (DB2OLEDB), the query is unsuccessful and you always receive the following error message:
SQLSTATE: 07001, SQLCODE: -313
For example, the following SQL statement is unsuccessful:
SELECT e.* FROM LIBNAME.PUBLISHERS p, LIBNAME.EMPLOYEE e WHERE e.PUB_ID = p.PUB_ID AND p.STATE = ?

In contrast, the following SQL statement is successful (the only difference is in the SELECT clause):
SELECT * FROM LIBNAME.PUBLISHERS p, LIBNAME.EMPLOYEE e WHERE e.PUB_ID = p.PUB_ID AND p.STATE = ?
If you view a Network Monitor capture of the problem, you can see that the OLE DB Provider for DB2 does not send a SQLDTA command to the target DB2 system that contains the parameter information.

↑ Back to the top


Cause

The OLE DB Provider for DB2 SQL parser does not correctly handle the tablename.* syntax.

↑ Back to the top


Resolution

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft Host Integration Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
328152 How to obtain the latest service pack for Host Integration Server 2000

Hotfix information

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version        Size    File name
   ----------------------------------------------------------
   29-Apr-2003  00:33  5.0.0.910     311,568  Crtpkg.dll
   29-Apr-2003  00:33  5.0.0.910     680,208  Db2oledb.dll
   29-Apr-2003  00:33  5.0.0.910      78,096  Mseidb2c.dll
   29-Apr-2003  00:33  5.0.0.910     885,008  Mseidb2d.dll
   29-Apr-2003  00:33  5.0.0.910      24,848  Mseidpm.dll
   29-Apr-2003  00:33  5.0.0.910     262,416  Mseidrda.dll
   29-Apr-2003  00:33  5.0.0.910     147,728  Mseidt.dll
   29-Apr-2003  00:33  5.0.0.910      65,808  Crtpkg.exe
   29-Apr-2003  00:34  5.0.0.910      82,192  Ddmserv.exe
				

Note Because of file dependencies, the most recent fix that contains the preceding files may also contain additional files.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

This problem was corrected in Microsoft Host Integration Server 2000 Service Pack 2.

↑ Back to the top


Workaround

To work around this problem, use an alternative to the tablename.* syntax. The asterisk ( *) syntax will return all fields from all tables used in the query, or the field names can be specifically referenced. For example (shown in the following SQL Statement):
SELECT e.AU_LNAME, e.AU_FNAME, e.AU_ID FROM LIBNAME.PUBLISHERS p, LIBNAME.EMPLOYEE e WHERE e.PUB_ID = p.PUB_ID AND p.STATE = ?

↑ Back to the top


More information

The SQLSTATE:07001, SQLCODE:-313 error has the following meaning on DB2/400:
SQL0313 SQLCODE -313 SQLSTATE 07001, 07004
Explanation: Number of host variables not valid.

↑ Back to the top


Keywords: KB819528, kbhotfixserver, kbqfe, kbfix, kbbug

↑ Back to the top

Article Info
Article ID : 819528
Revision : 3
Created on : 10/26/2005
Published on : 10/26/2005
Exists online : False
Views : 622