How do I give an alternate name to a table?

  • Hi all,

    I have a database with several tables named as er1000, er1010, er1020, etc. Those names are not so friendly as one would expect (I have to live with them everyday because other systems use them and cannot be changed).

    My question is: is there some way I could tell SQL Server to consider er1000 when i type "customer", for example?. Please note that I don't mean table aliases inside queries, as in "select * from er1000 as customer". I want to write "select * from customer".

    Thanks in advance,

    Alexandre Martini

  • You could create views with the names you want to use that select from the tables.  Then, you could use the views in your queries.

    Greg 

    Greg

  • great Greg! I was searching for synonyms

  • Specially third party app databases will have this type object names to secure their propietery information...

    Make sure you don't break any contracts with vendor when you create views in the db because some of the vedors don't allow to create any other user objects.

     

    MohammedU
    Microsoft SQL Server MVP

Viewing 4 posts - 1 through 3 (of 3 total)

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