Skip to main content
Adding another example
Source Link
jyao
  • 3.1k
  • 1
  • 13
  • 27

If I have to think of an advantage of having prefix 'tbl', it is that in current SSMS, with intellisense, I can just type

select * from tbl

and then find the table name I need (assuming I have no idea about exact table name). This is one-step work. Of course, we can always find out the table name through additional steps, but I'd say that with 'tbl' prefix, this is the ONE step work, and that's why I always prefer a prefix (not necessarily 'tbl') in my own homework project.

Edit: (After so many down votes, I still think it is worthwhile pointing out some niche advantages of giving a specific prefix to a specific category of objects in sql server). It seems no one complains having a prefix for stored procedure/functions/views, but there is always argument about doing so with tables. (To me, in real world I cannot care less whether we give a prefix or not to tables).

I remember in sql server 2005 days, there was a requirement to find what tables are used in which stored procedures / views, with table names prefixed, it was such an easy job with Regular Expression/C#. (Yes, I know there were other ways, no argument here).

My career grows with reading lots of "best practices" papers / articles, but I also have seen enough exceptions to almost every "best practice" one way or another in different scenarios. Thus, I always tell myself and my fellow DBAs, make the judgement according to the business requirements, "best practice" has its place for sure, but it can only be considered in the context of our own environment.

If I have to think of an advantage of having prefix 'tbl', it is that in current SSMS, with intellisense, I can just type

select * from tbl

and then find the table name I need (assuming I have no idea about exact table name). This is one-step work. Of course, we can always find out the table name through additional steps, but I'd say that with 'tbl' prefix, this is the ONE step work, and that's why I always prefer a prefix (not necessarily 'tbl') in my own homework project.

If I have to think of an advantage of having prefix 'tbl', it is that in current SSMS, with intellisense, I can just type

select * from tbl

and then find the table name I need (assuming I have no idea about exact table name). This is one-step work. Of course, we can always find out the table name through additional steps, but I'd say that with 'tbl' prefix, this is the ONE step work, and that's why I always prefer a prefix (not necessarily 'tbl') in my own homework project.

Edit: (After so many down votes, I still think it is worthwhile pointing out some niche advantages of giving a specific prefix to a specific category of objects in sql server). It seems no one complains having a prefix for stored procedure/functions/views, but there is always argument about doing so with tables. (To me, in real world I cannot care less whether we give a prefix or not to tables).

I remember in sql server 2005 days, there was a requirement to find what tables are used in which stored procedures / views, with table names prefixed, it was such an easy job with Regular Expression/C#. (Yes, I know there were other ways, no argument here).

My career grows with reading lots of "best practices" papers / articles, but I also have seen enough exceptions to almost every "best practice" one way or another in different scenarios. Thus, I always tell myself and my fellow DBAs, make the judgement according to the business requirements, "best practice" has its place for sure, but it can only be considered in the context of our own environment.

Source Link
jyao
  • 3.1k
  • 1
  • 13
  • 27

If I have to think of an advantage of having prefix 'tbl', it is that in current SSMS, with intellisense, I can just type

select * from tbl

and then find the table name I need (assuming I have no idea about exact table name). This is one-step work. Of course, we can always find out the table name through additional steps, but I'd say that with 'tbl' prefix, this is the ONE step work, and that's why I always prefer a prefix (not necessarily 'tbl') in my own homework project.