Naming Conventions Help

  • Hi All,

    Can anyone please help me for this?

    Lets In My Web Application 5 Modules are there.

    Ex :

    ====

    Module1, Module2, Module3, Module4, Module5

    I wants my database design should follow this.

    as per SQL Server 2005, if you open SQl Server management Studio,

    the Table folder Contains System Tables Folder and rest of the tables are presents on default location.

    If I have 277 number of table in my Database, its going to same place as default position, which is really problem for my team to search a particular Table.

    Here I My Query :

    How Can I specify which table belongs to which Module?

    Personal Suggestion:

    Can We create a folder as per our requirements?

    Is this present in new MS SQL Server 2008,

    If not then it should be present in SQL 2008?

    AM I rite?

    Cheers!

    Sandy.

    --

  • What about using a SCHEMA? Then you'd see the list like this:

    Module1.Table1

    Module2.Table2

    Etc. Then you can use the Filter function in SSMS to only display the schema that you're interested in.

    Another option is to simply name the tables:

    Module1Table1

    Module2Table2

    Then again use the Filter function in SSMS to only display the tables that contain the beginning string that you're looking for.

    I just took a quick look at Katmai (2008) and you still can't create folders, etc. You should look at one of these two methods. Personally, I'd lean towards the schema approach. OK, actually, I'd implement the schema approach because that's what I'm doing now with my apps that distinct modules or behaviors that we want to differentiate within the system either by storage, security or both.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey suggestion is good, do the same way. I was developed my database similar to this notation.

    🙂

  • Hey Grant,

    How can you manage all the Schema?

    Are you giving permission to all schema for access?

    Cheers!

    Sandy.

    --

  • So far we only three or four schema per database. We manage our security through a role in the database. The roles get access to stored procedures. The stored procedures are owned by different schema. It's not that hard to maintain at all.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • The only problem I see in such a naming convention is if you have a usefull function, proc, table, or view that is used in one schema that you'd like to use in another... it's not a problem to use it, but then your naming convention is violated, or you must maintain two copies, or you must rename the object and change all the code that references it.

    Personnally, I wouldn't name anything in the database after an application module... "keep the names generic" would be my suggestion.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi All,

    Grant, I am clear now with respect to Naming Conventions.

    I think Jeff's suggestion works better for me according to the situation.

    Just a simple question of mine,

    If I will give my Table name as like

    tst_Adm_UserDetails

    ,

    [Database_Module_TableName]

    Will it raise any performance issue, why because, I always follow the SQL standards and no where underscores followed in table naming,

    so can i go ahead with this naming, so our team can find the table name easily from the database?

    Cheers!

    Sandy.

    --

  • Heh... I'm confused... I recommended generic names, not DATABASE_MODULE_TABLE...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I agree with Jeff here. Naming tables after the database they're contained in is not going to be helpful. Also, I wouldn't recommend using the module in the names. I'd suggest using schema's. You should name the objects in your database for the business data that they represent. But, you can get specific where appropriate. You may have a table [User], but that doesn't mean you can have a table [AppUser] that stores different data and represents different functionality. You could also have [App1User], [App2User] that represent mapping tables between App1 and the original [User] table. All this stuff is kind of arbitrary, but you don't want to hang all kinds of unecessary crud off the name of the object. For example, I still regularly see TBL_TableName or some derivative so that we can know that the table is a table. Blechh!

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • third vote here for Jeff's suggestion. Use names that describe what the procedure does, not what it accesses.

  • Hey Jeff,

    I just asked my question not what you suggested me.

    I clearly understood what you suggest me, only generic name for the Database Objects.

    Grant,

    I too like your concept, but it can be possible if you are in the 1st stage of database developments and requirements is clear to you.

    I want to say one thing for Steve Jones...

    third vote here for Jeff's suggestion. Use names that describe what the procedure does, not what it accesses.

    Cool, I also agree with you Steve,

    Cheers!

    Sandy.

    --

  • Sandy (1/7/2008)


    Hey Jeff,

    I just asked my question not what you suggested me.

    I clearly understood what you suggest me, only generic name for the Database Objects.

    Didn't look that way to me, Sandy, because you said ...

    so can i go ahead with this naming, so our team can find the table name easily from the database?

    ... must be the language barrier, huh? 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hey Jeff,

    he he he....:P

    Can I ask you one small question?

    If I will give this naming, Am I violating the SQL Standards....?

    Cheers!

    Sandy.

    --

  • Heh, heh... in my shop, yes... 😛

    Check the following URL... someone made the terrible mistake of naming tables and objects after customers and now he's in a bit of trouble...

    http://www.sqlservercentral.com/Forums/Topic439936-5-1.aspx

    Do what you want, but it' a world of pain you're asking for if you name objects by application, customer, or database... period.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If you feel that you must split application code to make it easy to find, create a new database for each application... store only code and definition tables in these databases and build synonyms to point to the objects you need to address in other databases so you can avoid the use of the 3 part naming convention in your code. It doesn't take very much to do so and the future benefits will pay off big time... easier backups, easier restores, easier code maintenance, etc, etc.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply