I have recently moved a database from Sql Server 2000 to Sql Server 2005. In the table designer, it insists on putting square brackets around a column named "Content" I don't see Content on the list of reserved words for Sql Server, so I don't understand why it is doing this. Is there a way I can prevent it?
-
1"Square" and "Brackets" are not very good tags. – maxpower47 Sep 04 '09 at 15:22
-
I was told the markup is a holdover from Access. I don't care for it either. – OMG Ponies Sep 04 '09 at 18:06
3 Answers
CONTENT is a keyword when defining an XML column with a schema.
See here.
Edit: The MSDN link is broken (per Champ's comment), so here is the relevant extract:
Creating a typed XML column is as simple as adding the name of the schema inside parentheses, as you see here:
CREATE TABLE Foo(FooID INT, someXml XML(CONTENT FooSchema))
This statement indicates that the
someXml
column must adhere to the XML Schema Collection namedFooSchema
. You can specify that the XML must be a document or that it can contain a fragment by including the appropriate keyword,DOCUMENT
orCONTENT
, respectively. If omitted, the default isCONTENT
.

- 1
- 1

- 23,270
- 2
- 52
- 65
-
1all true tho they did forgot to add it to the list of reserved words on msdn :) anyway ... +1 nice link – Lil'Monkey Sep 04 '09 at 15:33
-
-
link is broken. Here is an archived content of the link: https://web.archive.org/web/20141006161826/http://msdn.microsoft.com/en-us/magazine/cc163611.aspx – Champ Apr 13 '16 at 22:04
The problem is that the field has the same name as the table. Sql Server 2000 did not seem to care about this potential ambiguity, but Sql Server 2005 does. When I add a field named Content to a table that is not named Content, the square brackets do not appear.
pamela

- 184
- 1
- 1
- 9
No, you can't prevent it. You can always add square brackets around a column name so it doesn't hurt anything.

- 34,223
- 3
- 62
- 80