473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SQL Select Question

Hello,

This is probably a stupid question but I am going to ask it anyway because I
don't know the answer to it. Both SQL Select Statements, below, execute and
retuurn the same results. Why would on put the [ around the table and
column names?

SELECT Customer.FirstName FROM Customer
or
SELECT [Customer].[FirstName] FROM [Customer]
Thanks,
Rob Panosh

Jul 20 '05 #1
4 3177

brackets are used when table/column names contain spaces or keywords.in
other cases brackets may be used also but also could be avoided.
"Rob Panosh" <ro************************@asdsoftadfdware.com> wrote in
message news:3f******@news.splitrock.net...
Hello,

This is probably a stupid question but I am going to ask it anyway because I don't know the answer to it. Both SQL Select Statements, below, execute and retuurn the same results. Why would on put the [ around the table and
column names?

SELECT Customer.FirstName FROM Customer
or
SELECT [Customer].[FirstName] FROM [Customer]
Thanks,
Rob Panosh

Jul 20 '05 #2
See the following topic from Books Online:
http://msdn.microsoft.com/library/en...on_03_6e9e.asp

In your example the delimiters are not essential since the names don't
include special characters or reserved words. However, using the delimiters
protects your code against the possibility that a name used as an identifier
may be declared a reserved word in a future version of SQL Server. That's
not likely for words like "Customer" but in the interests of a common style
and good programming practice this style may be adopted for all identifiers.
As with any aspect of coding style, different developers have different
preferences and practices.

The ANSI standard delimiter is to use double quotes which works in TSQL
assuming the QUOTED_IDENTIFIER option is ON. [] is an alternative notation
used in Access and SQLServer.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #3
David,

Thank you for the explanation.

Rob

"David Portas" <RE****************************@acm.org> wrote in message
news:ga********************@giganews.com...
See the following topic from Books Online:
http://msdn.microsoft.com/library/en...on_03_6e9e.asp

In your example the delimiters are not essential since the names don't
include special characters or reserved words. However, using the delimiters protects your code against the possibility that a name used as an identifier may be declared a reserved word in a future version of SQL Server. That's
not likely for words like "Customer" but in the interests of a common style and good programming practice this style may be adopted for all identifiers. As with any aspect of coding style, different developers have different
preferences and practices.

The ANSI standard delimiter is to use double quotes which works in TSQL
assuming the QUOTED_IDENTIFIER option is ON. [] is an alternative notation
used in Access and SQLServer.

--
David Portas
------------
Please reply only to the newsgroup
--

Jul 20 '05 #4
Makjalele,

Thanks ....

Rob

"Makjalele" <st******************@net.hr> wrote in message
news:br**********@ls219.htnet.hr...

brackets are used when table/column names contain spaces or keywords.in
other cases brackets may be used also but also could be avoided.
"Rob Panosh" <ro************************@asdsoftadfdware.com> wrote in
message news:3f******@news.splitrock.net...
Hello,

This is probably a stupid question but I am going to ask it anyway
because I
don't know the answer to it. Both SQL Select Statements, below, execute

and
retuurn the same results. Why would on put the [ around the table and
column names?

SELECT Customer.FirstName FROM Customer
or
SELECT [Customer].[FirstName] FROM [Customer]
Thanks,
Rob Panosh


Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
6
by: @sh | last post by:
Need help again! Here's the head script... ---------------------------------------------------------------------------------------- function Ash_ChangePicFromSelect(TheSource,TheDestination) {...
1
by: Christopher DeMarco | last post by:
Hi all... I've written a class to provide an interface to popen; I've included the actual select() loop below. I'm finding that "sometimes" popen'd processes take "a really long time" to...
5
by: GTi | last post by:
Whats wring with this code? <select class=EditField size="1" name="PlantUnitID" title="Select line"> <option value="0" >Standalone Unit</option> <option value="1" selected >Connected Unit...
2
by: Eitan | last post by:
Hello, I want a solutions for a compicateds sql select statments. The selects can use anything : views, stored procedures, analytic functions, etc... (not use materialized view, unless it is...
21
beacon
by: beacon | last post by:
Hello to everybody, I have a section on a form that has 10 questions, numbered 1-10, with 3 option buttons per question. Each of the option buttons have the same response (Yes, No, Don't know),...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.