Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Square brackets around column name in..

Status
Not open for further replies.

Elliott3

Programmer
Joined
Sep 5, 2002
Messages
347
Location
CA
What does it mean when there are squre brackets "[]" around a column name in design view using enterprise manager?

CES
 
I figured it out... It's some sort of key word.
 
Sort of. You use the brackets to force the SQL engine to use the name of the field or table exactly as written even though it might have a space in it or maybe it is the same as an existing keyword in the SQL language.
-Karl
 
Square brackets are identifier delimitters (can also use double quotes if the server is set up for it).
You will find them around any identifier.

It allows sql server to accept normally invalid characters in identifiers but you should be careful as it can cause problems with other things. I try to stick to alphanumerics - without spaces but the occasional underscore. Makes life easier.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
When I create a table, I often checek it out in ENterprise Manager to see if any of the field names have brackets for key words I maybe hadn;t thought of. If they do, I immediately change the field name before any code is written against it. Trust me, you don't want to have fields that require the brackets, so avoid key words and avooid using spaces when naming fields. If you have a field like this you will aways have to refer to it using the brackets.
 
Thanks for the feedback!

CES
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top