synonyms for table column

  • Dear All

    The way we hide the tbale name from user by using the synonyms. Is there a way to hide the column name.

    Regards

    Krishna1

  • Create a VIEW?

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • In that case we need to create views for all the tables. Is there any other way?

  • Do you have an example of what you are trying to acheive ?

    ________________________________________________________________________________________________
    Regards
    Steve
    SQL 2008 DBA/DBD - MCTS/MCITP

    Please don't trust me, test the solutions I give you before using them.

  • As far as i know, a SYNONYM must point to an object, that is, something that exists in sys.objects. that's typically, a table/view/procedure/function, but could technically be anything that exists in sys.objects.

    if you need to modify the name of a column, the suggested action of creating a view is the only way to change something like MySynonym.GF53SD to be MySynonym.CorporationName

    That is what you are trying to do right? either clear up the purpose of a column, or abstract it away from the real column name?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • if my table is customer having column col1,col2 ...

    in the select query i want all the developners to access it in the query as

    select customercode, customername

    from mycstomer

    instead of

    select col1, col2

    from cutomer

    please note that i just give column names as col1,col2 for eg purpose. In real db it has got meaningful names

  • Krishna1 (4/8/2013)


    if my table is customer having column col1,col2 ...

    in the select query i want all the developners to access it in the query as

    select customercode, customername

    from mycstomer

    instead of

    select col1, col2

    from cutomer

    please note that i just give column names as col1,col2 for eg purpose. In real db it has got meaningful names

    yes, in that case you'll have to create a view witht eh aliases on the column names.

    no other way to do it.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Unfortunately - you will need to create views to reflect the field names atht you require.

    ________________________________________________________________________________________________
    Regards
    Steve
    SQL 2008 DBA/DBD - MCTS/MCITP

    Please don't trust me, test the solutions I give you before using them.

  • Either that or bloat your tables with computed columns to represent the columns you want in your queries.

Viewing 9 posts - 1 through 8 (of 8 total)

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