SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Using Brackets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SharkAl
Starting Member

United Kingdom
8 Posts

Posted - 07/30/2014 :  17:01:47  Show Profile  Reply with Quote
Hello all,

I have been using SQL for several years but just starting with my exams and have a question I hope someone can clear up.

When are brackets best used? To my knowledge they are used if you would like a particular part of your statement queried first. Is this right?

When else should they be used?

Thanks

Alan

tkizer
Almighty SQL Goddess

USA
37291 Posts

Posted - 07/30/2014 :  17:17:41  Show Profile  Visit tkizer's Homepage  Reply with Quote
Do you mean square brackets around an object name or parenthesis? Show us an example and use the bold tag for the part in question.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

SharkAl
Starting Member

United Kingdom
8 Posts

Posted - 07/31/2014 :  03:43:50  Show Profile  Reply with Quote
it's ok, I think I have it.

If for example you have Select LEFT('ABC', 3) then the parenthesis are used to contain an expression. Is that right?

The reason I was confused mainly was because they seem to be used on a number of different occasions, to identify columns, expressions etc. Is a good rule of thumb that they are used to contain expressions?
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
37291 Posts

Posted - 07/31/2014 :  12:19:07  Show Profile  Visit tkizer's Homepage  Reply with Quote
Not a rule of thumb. It is necessary for functions and also for order of operations.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000