Results 1 to 6 of 6

Thread: alias naming

  1. #1
    Join Date
    Sep 2003
    Posts
    5

    Arrow Unanswered: alias naming

    Hi,
    I want help regarding the following scenario...
    My scenario is ...
    I want to give description for each field somewhere in the database..
    such that i should use that description as alias name in the SQL queries or Stored procedures...
    For example....
    Table : 'Table1'

    Clumns Description

    Field1 xxx
    Field2 yyy

    Query : Select Field1 as xxx , Field2 as yyy from Table1.

    Mr requirement....
    1.I want to specify tag or description for each field
    2. if i change the description 'xxx' as 'x1x1x1',it should be automatically updated in the Query,Views,Storedproc.. wherever the table and the fields are referred.

    can any one help me?.

  2. #2
    Join Date
    Dec 2001
    Location
    India
    Posts
    25

    Re: alias naming

    If you are storing alias name for columns,
    you have to use dynamic sql, to get the results.

    I think, your requirement is so complicated to implement.
    What advantages you will get, if you implement it..?

    Regards,
    Selva Balaji. B

    Originally posted by durgadevi_n
    Hi,
    I want help regarding the following scenario...
    My scenario is ...
    I want to give description for each field somewhere in the database..
    such that i should use that description as alias name in the SQL queries or Stored procedures...
    For example....
    Table : 'Table1'

    Clumns Description

    Field1 xxx
    Field2 yyy

    Query : Select Field1 as xxx , Field2 as yyy from Table1.

    Mr requirement....
    1.I want to specify tag or description for each field
    2. if i change the description 'xxx' as 'x1x1x1',it should be automatically updated in the Query,Views,Storedproc.. wherever the table and the fields are referred.

    can any one help me?.

  3. #3
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Re: alias naming

    There isn't such a functionality within the database. Using the standard tools like Enterprise Manager or Query Analyzer, you have to use the physical names, and to assign the logical names every time again.

    You may consider to make a view for each table assigning your logical names.

    Client tools, however, can replace the physical names by logical ones in the user interface. Look, for example, the DB Explorer.
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  4. #4
    Join Date
    Sep 2003
    Posts
    5

    Arrow Re: alias naming

    Hi,
    Actually in my application...
    I am creating more stored procedures based on a single table...(database already used by another application).
    Since i can't change the field names, i am making use of alias name for the required fields in Stored procedures and binding tha data in the front end where the alias name gets displayed.
    I've more than 500 stored procedures in my database.
    If I want to change a field caption ,
    I cannot change the existing field's name since it is already used by other application.
    Also It is very hard to find out and change the alias name in each and every stored procedure wherever it is referenced.

    So i am trying to look in other chances....to reflect the change in every stored procedure with a single move.

    Is it possible?...
    plz help me...
    bye
    by
    durga

  5. #5
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Re: alias naming

    And what about using views? You may consider not to assign your alias within every stored proc, but once in a view definition. If you change aliases in a view, your stored proc will return the changed name, assuming that you are working with SELECT * statements. This is consistent for all stored proc based on a particular view.
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  6. #6
    Join Date
    Nov 2002
    Location
    Warsaw, PL/Oslo, NO
    Posts
    2

    Re: alias naming

    You may want to have a look at extended properties
    (sp_addextendedproperty, sp_updateextendedproperty, sp_dropextendedproperty).

    It will not let you use the alias'es directly, but you do not have to come up with tables/functions etc to utilize them.

    To use them you must (by code if you can, use syscomments or sqldmo) regenerate alll ddl's wher ethey are referenced (sysdepends, sysreferences).

    not a small task...

    Originally posted by durgadevi_n
    Hi,
    I want help regarding the following scenario...
    My scenario is ...
    I want to give description for each field somewhere in the database..
    such that i should use that description as alias name in the SQL queries or Stored procedures...
    For example....
    Table : 'Table1'

    Clumns Description

    Field1 xxx
    Field2 yyy

    Query : Select Field1 as xxx , Field2 as yyy from Table1.

    Mr requirement....
    1.I want to specify tag or description for each field
    2. if i change the description 'xxx' as 'x1x1x1',it should be automatically updated in the Query,Views,Storedproc.. wherever the table and the fields are referred.

    can any one help me?.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •