ACC2000: Unexpected Behavior with Case-Sensitive Objects
ID: Q223202
|
The information in this article applies to:
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
In a Microsoft Access project, if you are connected to either a Microsoft SQL Server or to a Microsoft Data Engine (MSDE) that has a Sort Order set to "Dictionary order, case-insensitive," but has Unicode Collation case sensitivity turned on, you can see unexpected behavior. This behavior can occur with this type of server if you have objects that have the same name but that are spelled with all or some letters in a different case. In this scenario, you can see the following two unexpected behaviors:
Wrong Object Is Deleted
If in the user interface of the Access project, you try to delete the second or greater object of the same name, you find that actually the first object with that name is deleted. For example, suppose that you have the following tables listed:
categories
Categories
CATEGORIES
In an Access project file connected to this database, if you try to delete the table named "CATEGORIES," you find that you have actually deleted the table named "categories."
Table Appears to Contain No Data
If in the user interface, you try to open the second or greater table of the same name, you actually see the columns of the first table and they are empty. For example, suppose that you have the following tables listed:
categories
Categories
CATEGORIES
In an Access project file connected to this database, if you try to open the table named "CATEGORIES," you see that columns from the table named "categories" are shown instead and those columns are empty.
CAUSE
The Access project uses the sort order to determine which object to delete or open. The default Sort Order of both Microsoft SQL Server and Microsoft Data Engine is "Dictionary order, case-insensitive," meaning they ignore case when acting upon objects. Also, the default setting for Unicode Collation is case-insensitive. However, if during the setup of Microsoft SQL Server or MSDE, the Unicode Collation case sensitivity is turned on, but the Sort Order is left at the default of "Dictionary order, case-insensitive," it allows objects with the same spelling but with different case to exist on the server.
Using a server set up in this way, if you delete or open an object in the user interface of the Access project, Access finds the first occurrence of the object name that matches the spelling but does not try to match the case because it is using a dictionary sort order that is case-insensitive. Therefore, the wrong object could be chosen.
NOTE: This behavior does not occur if the server was set up with case-sensitive sort order as well as case sensitive Unicode collation.
RESOLUTION
The following steps show you how to work around these two behaviors. The steps use tables named CATEGORIES and Categories. You should replace these table names with the names of your tables.
Deleting Objects That Have Same Name/Different Case
Delete an object by using the DROP statement in a stored procedure. To do so, follow these steps:
- In the Database window, click Stored Procedures under Objects, and then click New.
- In Design view, type the following into the new stored procedure:
Create Procedure DelTable
AS
DROP TABLE CATEGORIES
Return
- Press F5 to refresh the Database window.
Browsing Tables That Have Same Name/Different Case
View the table by using a stored procedure. To do so, follow these steps:
- In the Database window, click Stored Procedures under Objects, and then click New.
- In Design view, type the following into the new stored procedure:
Create Procedure ShowTable
AS
SELECT * FROM Categories
Return
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
MORE INFORMATIONSteps to Reproduce Behavior
- On a clean machine running either Microsoft Windows 95 or 98, or Windows NT 4.0 SP3, run the Setup program of either Microsoft Data Engine (MSDE) or Microsoft SQL Server 7.0.
- If you are running SQL Server 7.0, in order to see the dialog box for the next step, make sure to select Custom Setup.
- In the Character Set/Sort Order/Unicode Collation dialog box, set the Sort Order to Dictionary order, case-insensitive and under Unicode Collation, make sure the Case-insensitive option is not selected (not checked).
- Complete the setup with all other defaults.
- On the same machine, install Access 2000.
- Make sure MSDE or SQL Server is running.
- Open Access and from the Microsoft Access dialog box list, select Northwind SQL Project File and click OK. The Access project opens.
- In the Install Database dialog box, click Yes. Access proceeds to install the SQL Server database NorthwindCS to your server.
- Once the database is created, click OK in the Installation Successful dialog box and OK on the startup screen.
- In the Database window, click Stored Procedures under Objects, and then click New.
- In the new stored procedure, type the following:
Create Procedure makeTestTables
As
SELECT * INTO test FROM Categories
SELECT * INTO TEST FROM Employees
RETURN
- Save and run the stored procedure.
- Press F5 to refresh the Database window.
- Click OK on the confirmation dialog box and go to Tables. Note that you have two tables with the same name but spelled with different case letters, "TEST" and "test." "TEST" contains a copy of the Employees table and "test" contains a copy of the Categories table.
- Double-click to open the table named TEST. Note that you see columns from the table Categories instead of from Employees. The table also appears empty.
- Close the TEST table.
- Select the table whose name is in all capital letters, "TEST."
- Press the DELETE key on the keyboard. Click Yes to the "Do you want to..." message.
Note that the "test" table has disappeared and the table "TEST" remains.
Additional query words:
pra upper lower title proper case
Keywords : kbdta AccessCS
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug
|