BUG: Table Designer Gives an Error with Quotes in a Column Name (197798)
The information in this article applies to:
This article was previously published under Q197798
BUG #: 41942 (SQLBUG_70)
SYMPTOMS
When designing a table in Enterprise Manager, you may receive the following
error message:
The name <string> is invalid because it is empty, contains invalid
characters, or is too long.
CAUSE
This error occurs when you try to create a column name that includes a
single quotation mark. This can occur either when you create a new table or
rename a column in an existing table. The error occurs even if the column
name is delimited with square brackets.
WORKAROUND
To work around this problem, try one of the following:
- If you are creating a new table, use the CREATE TABLE statement with
square brackets to create the table in Query Analyzer, as in the
following example:
CREATE TABLE table1 ([a'b] int NOT NULL)
-or-
- If you are trying to rename a column for an existing table, use the
sp_rename stored procedure with square brackets to change the column
definition in Query Analyzer. For example, you can change the column
name of [col1] on table [table1] to [col'1] by using the following
statement in Query Analyzer:
EXEC SP_RENAME [table1.col1], [col'1], 'COLUMN'
-or-
- If you want to use Enterprise Manager, do not include a single quotation
mark in the column name.
STATUS
Microsoft has confirmed this to be a problem in SQL Server version 7.0.
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbBug KB197798 |
---|
|