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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Start table name with tbl_XXXX

Author  Topic 

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2012-01-15 : 21:32:54
Hi,

All my tables start with tbl_XXXX as following,
1. tbl_chooseProgram
2. tbl_acctInfo
3. tbl_gender
4. and so on

Naming table with prefix tbl_, It's recommended or not?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-15 : 22:53:28
it depends on your coding standards. there's no hard and fast rule for this. Some people prefer using object type abbreviation like tbl_ for tables, vw_ for views etc. It will anyways add to clarity and seeing it enables user to understand that its a table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2012-01-16 : 00:06:39
tq sir
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-16 : 01:06:05
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-16 : 04:10:05
I have used VIEWs instead of Tables. For example, we need to split a table into two tables with 1:1 relationship. So we created VIEW to JOIN the two, new, tables to "look" the same as the original single table. We gave the View the same name as the original table. We often do this when we significantly change a table - e.g. to make a "version 2" of the table; change column names and so on.

That sort of thing means that a VIEW then has the same name as the original Table. Are you going to call the view "tbl_XXX" in that case?

For me the "tbl_" type prefix is unnecessary.

What we DO do is to have a prefix on all columns that is unique to the table, so that a column name indicates uniquely which table it is from, and we use the same "unique column name" for all @Variables [and application variables] that refer to that column. That makes it very easy to do a Global Find to reliably find ALL occurrences of usage of a column e.g. if we increase the size of a column.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-16 : 04:56:33
I hate object prefixes, with a passion. There is no need whatsoever to prefix objects with what they are (that comes from a complete misinterpretation of hungarian notation anyway)

If it's in the FROM clause without arguments it's a table or view. With arguments it's a function. Called with EXEC, it's a procedure. You can't exec a table, you can't select from a procedure. Using something to distinguish tables from views gives problems when refactoring the database and changing tables to views, you either have to change all the referencing code (which is what you're trying to avoid by creating a view) or you have a view named as if it were a table.

Hungarian notation is about naming objects and variables for what they are for, not what they are.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -