<p>What do the brackets do in a sql statement?</p>

<p>For example, in the statement:  </p>

<pre>insert into table1 ([columnname1], columnname2) values (val1, val2)</pre>

<p>Also, what does it do if the table name is in brackets?</p>

They are meant to escape reserved keywords or invalid column identifiers.
```
```
CREATE TABLE test
(
  [select] varchar(15)
)

INSERT INTO test VALUES('abc')

SELECT [select] FROM test
```
```