What is the use of the square brackets  in sql statements?
I've seen that Visual Studio 2008 is positioning square brackets around column names in sql. Do the brackets supply any kind of benefit? When I hand code T - SQL I've never ever troubled with them.
SELECT [column1], [column2] etc...
My very own means:
SELECT column1, column2 etc...
The brackets can be made use of when column names are booked words.
If you are programatically creating the SQL declaration from a collection of column names you do not regulate, after that you can stay clear of troubles by constantly making use of the brackets.
Column names can have personalities and also booked words that will certainly perplex the query implementation engine, so positioning brackets around them in all times stops this from taking place. Less complicated than looking for a concern and afterwards managing it, I presume.
They come in handy if your columns have the very same names as SQL search phrases, or have rooms in them.
create table test ( id int, user varchar(20) )
Oh no! Wrong syntax near the keyword 'customer'. Yet this:
create table test ( id int, [user] varchar(20) )
They serve if you are (for one reason or another) making use of column names with particular personalities as an example.
Select First Name From People
would certainly not function, yet placing square brackets around the column name would certainly function
Select [First Name] From People
In brief, it is a means of clearly proclaiming a object name ; column, table, data source, customer or web server.
The brackets are called for if you make use of search phrases or unique chars in the column names or identifiers. You can call a column
[First Name] (with a room)-- yet after that you would certainly require to make use of brackets every single time you described that column.
The more recent devices add them almost everywhere simply in instance or for uniformity.