• I have tested this stored procedure against a local copy of my database at work and it works great. The only problem is I would like to alias the table names. For example, if the table name is ProductName, I want the alias used to be PN, if it is Employee I want the alias used to be E.

    Where in Michael's code http://files.soendergaard.info/Install_spFixForeignKeyNaming_V2005-2008.sql do I make this change?

    Michael says:

    Example 6 – Solving long names with object aliases

    The stored procedure can automatically replace schema, table, parent or referenced column name, with an object alias instead.

    It works by using a mapping table and a synonym. The mapping table requires a certain structure, but may be named whatever you like. This is there the synonym comes in. The stored procedure requires the name to be called dbautils.AliasRulesSynonym, but it may point to a table in an external database. This is useful if you like to have a central object alias repository. The synonym give the flexibility, that you don't need to change the code of the stored procedure, you only need to change what the synonym points to.

    The parameter @UseAliases is a char mask. By setting the correct char mask, you have total control of what types of aliasing you want to enable.

    'C' = Column aliasing

    'T' = Table aliasing

    'S' = Schema aliasing