Link to home
Start Free TrialLog in
Avatar of Harreni
HarreniFlag for Saudi Arabia

asked on

Single repository table for all T-SQL coulmns aliases

Hi Experts,


- I want to have a master table for all columns aliases that exists in my stored procedures so, I can change the alias in one place instead of changing it in each stored procedures, because my data is in Arabic language and my table columns names are in english language and want to display the columns names in Arabic.

Please provide me an example in how to achieve that?


Thanks a lot

Harreni
Avatar of Docteur_Z
Docteur_Z
Flag of France image

I know you won't like the answer, but SQL is not the place where you should do stuff like this.
What your asking is to make every statement in your stored procedures to be dynamic.
Keep stored procedures static, read the dictionnary in your application - in an array for example, then map the column names to the dictionnary in your application.
SOLUTION
Avatar of Jose Torres
Jose Torres
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Agreed.  SQL server does not have an automated way to utilize multiple object name aliases in code, so If this means that much then perhaps the table and column names should be changed to Arabic.
Avatar of Harreni

ASKER

Thanks a lot Docteur_Z & Jim for your replies.

Mr. Jose,
What's the benefit from creating a view for my stored procure? Why not directly modify the stored procedure instead?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Vitor's example is spot on.
Avatar of Harreni

ASKER

Thanks a lot experts.