FIX: An INSENSITIVE Cursor That Retrieves TEXT/IMAGE Columns From a Non-Fully Qualified Table Causes a 7131 Error Message (263553)



The information in this article applies to:

  • Microsoft SQL Server 6.5 Service Pack 5a

This article was previously published under Q263553
BUG #: 19022 (SQLBUG_65)

SYMPTOMS

Starting with hotfix build 423, the following 7131 error message might occur:
Msg 7131, Level 16, State 1: Invalid table and column name specified in textvalid function.
when all of the following conditions are met:

  • You are logged on to SQL Server with the OWNER login of the table from which you are retrieving the rows.

  • You are using INSENSITIVE cursors.

  • You are retrieving TEXT/IMAGE columns.

  • The table is not qualified with the OWNER name.

RESOLUTION

A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next SQL Server service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:
   Date        Time      Version    Size      File name     Platform
   -----------------------------------------------------------------

   6/16/2000   2:55 AM   6.50.479   2.59 MB   Sql479i.exe   Intel
   6/16/2000   3:00 AM   6.50.479   4.33 MB   Sql479a.exe   Alpha
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.

WORKAROUND

You can use either of the following two methods as a workaround for this problem:
  • Use a cursor type other than INSENSITIVE, For example, you can use either the Forward_Only or Dynamic or KeySet cursor types.

    -or-

  • Qualify the table name with the owner name.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 6.5 (Build 423 and later).

MORE INFORMATION

The following example illustrates the problem in detail:

  1. Login as the system administrator (sa), and then run the following code:
         sp_addlogin 'Test', null, pubs
         go
         Use pubs
         go
         sp_adduser 'Test', 'Test'
         go
         grant all to Test
         go
       
  2. Login as Test (the new login you created in step 1), and then run the following code:
         Use pubs
         go
         create table pubs_text
         ( id char(4) not null,
           prinfo text )
         go
        insert into pubs_text values ( '0736', 'This is a sample test')
        go
    
        -- This fails with Error 7131
        DECLARE test_cursor INSENSITIVE CURSOR
             FOR SELECT prinfo FROM pubs_text 
        OPEN test_cursor
        FETCH NEXT FROM test_cursor
        CLOSE test_cursor
        DEALLOCATE test_cursor
        go
    
       -- This Works fine
        DECLARE test_cursor INSENSITIVE CURSOR
            FOR SELECT prinfo FROM Test.pubs_text 
        OPEN test_cursor
        FETCH NEXT FROM test_cursor
        CLOSE test_cursor
        DEALLOCATE test_cursor
        go
     
This problem does not occur with Microsoft SQL Server 7.0

Modification Type:MinorLast Reviewed:10/7/2005
Keywords:kbBug kbfix kbQFE KB263553