SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for April, 2010

FIX: DB-Library sp_cursor Fails with Error Message 16933 if Bracketed Identifiers are Passed with the Tablename Parameter

Symptoms
When you use the DB-Library API server cursors, if the table name parameter that is passed to the sp_cursor stored procedure includes a bracketed identifier, the execution of sp_cursor fails with the following error message:

SQL Server message 16933, state 2, severity 16:
The cursor does not include the table being modified or the table is not updatable through the cursor.Refer to the “More Information” section of this article for an example and additional symptoms.
Resolution
SQL Server is unable to successfully parse the bracketed table name with spaces.
DB-Library binds the table name as a SQLCHAR data type, which has a fixed length of 255 characters (the maximum length of this data type). The buffer holds the table name, including the brackets, with the remaining bytes padded with spaces.

FIX: DBCC CHECKDB May Produce an Access Violation When Database Is in Use

Symptoms
The DBCC CHECKDB command may produce an access violation (AV) when run on a database while other users are actively accessing the database.
Resolution
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack

FIX: DATABASEPROPERTYEX Function Reports Incorrect Status After You Restore Database and Set the Database to OFFLINE

Symptoms
If you restore a database with the NORECOVERY option and you then set the database OFFLINE, the DATABASEPROPERTYEX function may report an incorrect status for the database. The DATABASEPROPERTYEX functions reports the database status as ONLINE.
In addition, if you run a RESTORE DATABASE WITH RECOVERY statement, an EXCEPTION_ACCESS_VIOLATION may occur.
Resolution
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 theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack

FIX: CPU utilization may approach 100 percent on a computer that is running SQL Server 2000 every 49.7 days

Symptoms
This article describes the following about this hotfix release: The issues that are fixed by this hotfix packageThe prerequisites for installing the hotfix packageInformation about whether you must restart the computer after you install the hotfix packageInformation about whether you must make any registry changes The files that are contained in the hotfix package
Resolution
Consider the following scenario. You have a SQL Server 2000 service that is running on a computer that has a system time thatis approaching a multiple of 49.7 days from the time when the operating system is restarted. Around this period, you back up a database at least one time, or you restore a database at least one time. In this scenario, CPU utilization may approach 100 percent after the backup operation is complete or after the restore operation is complete. After approximately 15 minutes or less, CPU utilization automatically decreases.
If you back up the database or restore the database when CPU utilization approaches 100 percent, CPU utilization appears to decrease.
Note This problem appears to occur more frequently on Itanium-based computers than on x86-based computers. This problem is very noticeable on the SQL Server servers that perform backup operations or restore operations around this 49.7 day interval.
For a list of all publicly released SQL Server 2000 Post-Service Packhotfixes, see the following article in the Microsoft Knowledge Base:
894905?(http://support.microsoft.com/kb/894905/) Cumulative list of the hotfixes that are available for SQL Server 2000 SP4

FIX: Configuration Fails Pasting Distributor Database Name with a Leading Space

Symptoms
In the Configure Publishing and Distribution Wizard, if you select the option to customize the settings rather than accept the default values, you are given the opportunity to change the distribution database name from its default of “distribution.” Although you cannot type a space character in the Distribution Database Name box, it does accept a space character if you copy a text string (for example, “my database”) to the clipboard and paste it in.
If the name you use contains a space character, the database is still created. However, if the name that you paste in begins with a space character (for example, ” my database”), the wizard fails with the following error message:

SQL Server Enterprise Manager could not configure ’server_name’ as the distributor for ’server_name’.
Error 14262: The specified @database_name (‘db_name’) does not exist.
Resolution
To work around this problem:do not use spaces in the name
-or-
make sure that the database name you are pasting in does not contain a leading space character.

FIX: Coalesce with Subquery May Generate an Access Violation

Symptoms
When you run a coalesce query that contains a subquery the following error message may occur:

ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
Resolution
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack