sql server:what do brackets mean around column name?

Brackets are a form of quoting. It's only necessary if the column name contains spaces or punctuation or conflicts with a reserved word, but many wizards will just add the brackets for all field names to avoid the logic for deciding whether they are necessary.


Columns enclosed in square brackets are usually keywords or contain special characters or spaces.

What specific column name do you have enclosed in brackets?


Brackets allow you to use characters and names which are not allowed like spaces, reserved words and names starting with numbers

invalid my column, 1column col%umn, table

valid [my column], [1column], [col%umn], [table]

of course now you can become really creative :-)

create table [table]([table] varchar(20))

insert [table] values ('table')

select [table] from [table]

Tags:

Sql Server