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 |
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 09:56:38
|
| I need to be able to provide a more user friendly name for some data names from my data base on a query report. I entered a name in the description field but I don't know how to access that field in a query. I don't even know if the description field is accessible through a query. Does anyone have a method to override data names from a data base or provide an alias on a perpetual basis other than overriding manually in a query?Dave |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-15 : 10:01:26
|
[code]alter table yourtable add friendlyname as [uN_fRienDly-nAmE][/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-15 : 10:27:44
|
What you want is a SYNONYM. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 11:19:34
|
| Thanks for your replies. I tried the ALTER TABLE query and it worked just fine. Is there anyway to provide an alias for a table also? Dave |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-15 : 11:43:30
|
| http://www.developer.com/db/article.php/3613301 |
 |
|
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 12:39:13
|
| Thanks again for the info on the SYNONYM. It renames my tables. What would Microsoft do without these forums? Thanks to everyone.Dave |
 |
|
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 16:51:18
|
| I have one more question. Is there a way for me to do a query to see what the synonyms are for a table if any?Dave |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-15 : 17:51:56
|
Try the INFORMATION_SCHEMA views. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 21:06:27
|
| I tried every INFORMATION_SCHEMA I could find and none of them return SYNONYM names for a table. Its got to be stored somewhere.Dave |
 |
|
|
parrot
Posting Yak Master
132 Posts |
Posted - 2008-07-15 : 22:12:38
|
| I figured out how to get the SYNONYM tables. SELECT * FROM sys.synonymsOleDbDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()){ string synonym = rdr.GetString(0); // this is the synonym string table = rdr.GetString(12); // this is the table to which the synonym applies} |
 |
|
|
|
|
|