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

Article translations Article translations
Article ID: 817081 - View products that this article applies to.
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
Expand all | Collapse all

On This Page

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 'Table Name'.


Server: Msg 3704, Level 16, State 1, Line 1
User does not have permission to perform this operation on index 'Index Name'.

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.

RESOLUTION

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
BCPNoUpdateStats
registry entry at the following registry path:
HKLM\Software\Microsoft\Microsoft SQL Server\80\Tools\DMO
For additional information, see the "More Information" 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 "Applies to" 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:
  1. Start Regedt32.exe.
  2. Locate the following registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\80\Tools\DMO
    If this key does not already exist, create a new key that is named DMO under the \Tools key.
  3. Under the \DMO key, add a DWORD value, and then name it BCPNoUpdateStats. Set its value data to 1.
A value of 0 or no registry key results in the default behavior. The default behavior is to update statistics after the import operation.

REFERENCES

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
299865 FIX: DMO BulkCopy fails to copy data when column names contain the space character
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

Properties

Article ID: 817081 - Last Review: September 27, 2005 - Revision: 3.1
APPLIES TO
  • Microsoft SQL Server 2000 Service Pack 3
Keywords: 
kbbug kbfix kbqfe kbsqlserv2000presp4fix kbhotfixserver KB817081

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com