Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
bcanonica
Starting Member
35 Posts |
Posted - 2009-06-26 : 14:38:31
|
| Can you select an alias name from an external source table, user defined function, or a select statement to return a text string that you can use as column alias in another select statement or view? Any ideas of how to accomplish this on a database level? We don't have any choice, but to accomplish this at the database level since an external program will be looking at the data. TIA for any help as always you guys are the best,BC |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-26 : 14:48:45
|
| by external do you mean udf or table in another db? can you explain? |
 |
|
|
bcanonica
Starting Member
35 Posts |
Posted - 2009-06-26 : 14:59:28
|
| The values for the column names are in another table inside of the same database. I was just suggesting maybe a udf could return the text value from the table to use for the column alias name. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-26 : 15:08:38
|
| i think you might need to use dynamic sql for that. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-26 : 16:34:46
|
Yes without dynamic sql it is not possible.But the code will look not very fine!What is the meaning of an external program will be looking at the data?Why it is not possible to create a view with wanted column names without reading column names/alias from another table?GreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-27 : 09:51:26
|
| www.sommarskog.se/dynamic_sql.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|