• Jeff Moden (2/11/2013)


    Andy Hyslop (2/11/2013)


    I recently has to take a written SQL test for a client and one of the questions got me stumped (from memory was something like this):

    Why should User Defined Functions not be prefixed UDF or udf, views not Prefixed with VW or vw and Stored Procedures not USP or usp

    I couldn't come up with a reason for not using these naming conventions..:crazy:

    Can anyone enlighten me?

    Andy

    I agree with what has already been suggested but I have a cold, hard reason for not doing it for tables and views. There have been many times where I've needed to change the structue of a table but couldn't do so because of some bad coding practices on the front end. To trick the front end into not seeing the change, I changed the table name to something else and then made a view using the original table name. I don't know about you but it kind of defeats the whole purpose to have a view with a prefix of "tbl". 😉

    Synonyms could probably get around this type of scenario to Jeff. Then you don't need a view either. 😛 I do agree though that object prefixes are not a good idea.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/