469,082 Members | 1,108 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,082 developers. It's quick & easy.

Using a Select statment for the name of the field?

Do any of you know if it's possible to get the name of your field from
another table?

E.g.

Select FYear as [Select description from YearTable where category=1]

I need the name of the fields to be user defined and the only way I
can see this happening is through a table. But now...how do I get the
field name from the table?

Any help would be appreciated!!!!

Thank you,
Susan
Jul 20 '05 #1
2 1084

"sbligh" <sb****@canoemail.com> wrote in message
news:11**************************@posting.google.c om...
Do any of you know if it's possible to get the name of your field from
another table?

E.g.

Select FYear as [Select description from YearTable where category=1]

I need the name of the fields to be user defined and the only way I
can see this happening is through a table. But now...how do I get the
field name from the table?

Any help would be appreciated!!!!

Thank you,
Susan


Is this what you need?

select description as 'FYear'
from YearTable
where category=1

Or are you asking if you can store the name of a column or table to be
queried in a table? In that case, you would need dynamic SQL, but it's
generally not recommended:

http://www.sommarskog.se/dynamic_sql.html#Dyn_table

Simon
Jul 20 '05 #2
>> I need the name of the fields [sic] to be user defined .. <<

No, you need to learn to be a database programmer. A column -- which
is totally different from a field -- is a model for a data element.
If you let users define columns, they are designing the database on
the fly because you failed in your job.

If you just want a name for display, then do that in the presentation
layer, not in the database.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sylvia | last post: by
reply views Thread by elie chucrallah | last post: by
2 posts views Thread by Michele Fondry via .NET 247 | last post: by
1 post views Thread by Anton Nikiforov | last post: by
10 posts views Thread by William Krick | last post: by
1 post views Thread by Steffen Stellwag | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.