Naming objects in a database

When naming the different functions, stored procedures, views and tables I use the type <<where>>_<<type>>_<<what>> when not using schemas and <<where>>.<<type>>_<<what>> when i am.

The <<where>> is the grouping of the task i am trying to acomplish.
The <<type>> is either

  • STP (STored Procedure),
  • View,
  • SVF (Scalar Valued Function),
  • TVF (Table Valued Function),
  • TBL (TaBLe)

The <<what>> should describe what I try to do.

These naming rules makes it easier to disinguish where the objects used are comming from and find the when you search the database objects for references. The longer names should not be a problem as the IntelliSence and SQL Prompt makes the names easy to write.

Finding object text in objects can be done with this script found here.

I would also include tables in the result and this can be done by changing

type in (''FN'', ''IF'', ''P'', ''TF'', ''TR'', ''V'')

to this

type in (''FN'', ''IF'', ''P'', ''TF'', ''TR'', ''V'', ''U'')

Leave a Reply

Your email address will not be published. Required fields are marked *