Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 using sql keywords

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2008-04-25 : 12:24:14

When designing a table, or column name. I am sure its best to avoid using table names or column names that use reserved words such as

"status" and "message"

What happens when we name a column or table using these words? Any tiny performance hit ? I am just wondering whats happening behind the scenes.


Thanks!
mike123

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-04-25 : 13:59:12
none. since you have to quote them anyway -> [status]


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2008-04-25 : 16:02:26
quote:
Originally posted by spirit1

none. since you have to quote them anyway -> [status]




I've found that in some of my old designs and sprocs, I didnt quote them and it worked .. just wondering if its something that I could redesign ? I'll add quotes in the meantime :)
thx!
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-04-25 : 18:21:25
depending on the specific key word it may work without the brackets. If you have a column named [SELECT] you will always have to bracket that one :)

Be One with the Optimizer
TG
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-25 : 18:37:55
I believe you always have to use square brackets when you use a reserved word for a table name but not always the case with column names.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-04-26 : 02:35:33
just because a word changes color in the query editor doesn't mean it's a reserved word.

status and message are both examples of such words. neither requires the square brackets. go ahead and use those two for object or column names if you like.

http://msdn2.microsoft.com/en-us/library/ms189822.aspx


elsasoft.org
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-04-26 : 02:42:00
I work a lot with road and map data - in that field you come across the most ridiculous stuff. One of tables we get from the map data vendor has a column named TABLE. that's very confusing. Haven't run across any tables named COLUMN yet though...


elsasoft.org
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-04-26 : 09:28:12
Some idiot at one of my previous jobs (me) named a table [group]. We all had to live with that brainstorm for awhile :(

Be One with the Optimizer
TG
Go to Top of Page

m_k_s@hotmail.com
Insecure what ??

38 Posts

Posted - 2008-04-27 : 14:33:24
This isn't really a big deal. Brackets around keywords resolves most issues. If you continue to have issues, I'd try prefixing in addition to bracketing.
Go to Top of Page
   

- Advertisement -