Microsoft KB Archive/817081

= FIX: You receive an error message when you use the SQL-DMO BulkCopy object to import data into a SQL Server table =

Article ID: 817081

Article Last Modified on 9/27/2005

-

APPLIES TO


 * Microsoft SQL Server 2000 Service Pack 3

-



Bug #: 469152 (SQL Server 8.0)



Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



SYMPTOMS
You programmatically connect to an instance of Microsoft SQL Server 2000 as a user who is not a member of the sysadmin fixed server role or of the db_owner fixed database role, and then you use the SQL Distributed Management Objects (SQL-DMO) BulkCopy object to import data into a SQL Server table. After you do so, you may receive an error message that is similar to the following:

Server: Msg 3704, Level 16, State 1, Line 1

User does not have permission to perform this operation on table ' '.

Server: Msg 3704, Level 16, State 1, Line 1

User does not have permission to perform this operation on index ' '.



CAUSE
This problem occurs because the bulk copy operation that is initiated by the SQL-DMO BulkCopy object tries to update the statistics for the SQL Server table. However, to run the Update Statistics command, the current user must have system administrator (sysadmin) permissions or database owner (db_owner) permissions.



Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 How to obtain the latest SQL Server 2000 service pack

Hotfix information
The English version of this hotfix has the file attributes (or later file attributes) 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 --  17-Mar-2003  07:38  2000.80.790.0   4,215,360  Sqldmo.dll Notes Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.

To disable updating statistics for BulkCopy, you may have to add the  registry entry at the following registry path:

For additional information, see the &quot;More Information&quot; section.



WORKAROUND
To work around this problem, you can use another method to perform the bulk copy operation, such as the bcp utility, the BULK INSERT Transact-SQL statement, or a DTS package.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

This problem does not occur in the earlier versions of SQL Server 2000.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.



MORE INFORMATION
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

This fix works with a DWORD registry entry, BCPNoUpdateStats. If you turn on BCPNoUpdateStats, the automatic Update Statistics command is disabled when you import data. To add and to turn on the BCPNoUpdateStats registry entry, follow these steps:  Start Regedt32.exe. Locate the following registry key:

If this key does not already exist, create a new key that is named DMO under the \Tools key. Under the \DMO key, add a DWORD value, and then name it BCPNoUpdateStats. Set its value data to 1.</ol>

A value of 0 or no registry key results in the default behavior. The default behavior is to update statistics after the import operation.

<div class="references_section">