Using Brackets in SQL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am curious if it necessary or desireable to put [ ] around string data that
is stored in sql. I need to create several varchar columns and one text
column. Are there times when string data going into these fields requires
brackets?

Fred Herring
 
Hi Fred,

Square brackets are required on certain types of metadata names, such as
column names having a space char, example:
[Column with three spaces]
 
Data or field names ? Field names are bracketed when their names is
conflicting with a reserved keyword or contains chars such as the white
space (if you allow this in your DB). You could also use always brackets...

IMO you saw this. I see no reason to surround data themselves by brackets..
Just store plain data as they should.


Patrice
 
So there is no reason to encase data inside sql columns in brackets. It is
only when you are referencing complex field names that brackets are required.

Thanks,
Fred

Miha Markic said:
Hi Fred,

Square brackets are required on certain types of metadata names, such as
column names having a space char, example:
[Column with three spaces]

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Fred Herring said:
I am curious if it necessary or desireable to put [ ] around string data
that
is stored in sql. I need to create several varchar columns and one text
column. Are there times when string data going into these fields requires
brackets?

Fred Herring
 
Right.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Fred Herring said:
So there is no reason to encase data inside sql columns in brackets. It
is
only when you are referencing complex field names that brackets are
required.

Thanks,
Fred

Miha Markic said:
Hi Fred,

Square brackets are required on certain types of metadata names, such as
column names having a space char, example:
[Column with three spaces]

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Fred Herring said:
I am curious if it necessary or desireable to put [ ] around string data
that
is stored in sql. I need to create several varchar columns and one
text
column. Are there times when string data going into these fields
requires
brackets?

Fred Herring
 
Right (or table names, etc), but you really should avoid using such names...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Fred Herring said:
So there is no reason to encase data inside sql columns in brackets. It
is
only when you are referencing complex field names that brackets are
required.

Thanks,
Fred

Miha Markic said:
Hi Fred,

Square brackets are required on certain types of metadata names, such as
column names having a space char, example:
[Column with three spaces]

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Fred Herring said:
I am curious if it necessary or desireable to put [ ] around string data
that
is stored in sql. I need to create several varchar columns and one
text
column. Are there times when string data going into these fields
requires
brackets?

Fred Herring
 
Back
Top