469,111 Members | 1,964 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Selecting n-th attribute

Hi!

I have a following problem: I need to select some attributes from
table, i.e.
first, third, fifth...

Can anyone give me the hint how to do it. Is there some method to say
somthing like this:

SELECT $1, $3, $5 which will refer to the 1st, 3rd and 5th attribute?

Thanks!

Mario.
Jul 20 '05 #1
5 1224
Columns are referred to by name not by position. Please explain why you want
to do this so that someone can suggest an alternative solution. Your
requirement suggests to me either that this table is not normalised or that
you are trying to implement something that might be better handled in your
client application.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #2
If you are doing C++, ADO and ODBC can do this. I agree that you are
probably doing something wrong if you are doing this. I've seen people use
this construct before and it usually places an unneeded restriction on you.

Michael

"Mario Pranjic" <ke****@fly.srk.fer.hr> wrote in message
news:6a********************************@4ax.com...
Hi!

I have a following problem: I need to select some attributes from
table, i.e.
first, third, fifth...

Can anyone give me the hint how to do it. Is there some method to say
somthing like this:

SELECT $1, $3, $5 which will refer to the 1st, 3rd and 5th attribute?

Thanks!

Mario.

Jul 20 '05 #3
On Sat, 01 Nov 2003 22:41:00 GMT, "M Simpson" <no***@nowhere.com>
wrote:
If you are doing C++, ADO and ODBC can do this. I agree that you are
probably doing something wrong if you are doing this. I've seen people use
this construct before and it usually places an unneeded restriction on you.


I have to do it inside a stored procedure. Depending on user who
executes that procedure, it will return all just some of the
attributes.
The procedure also does some math on some restricted attributes
returning all or just a part of them. In case of lowest sec.level
user, it will return the tuple without those restricted attributes.
It also must work for all tables (it receives tablename as argument).

So, the client application will receive from database already filtered
data. That is why I must do this inside a SP.

Mario.
Jul 20 '05 #4
Create a view for each level of access. The view can be limited to just the
required base table columns and calculated values.

See "Using Views as Security Mechanisms" in Books Online.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #5
On Sun, 2 Nov 2003 09:17:51 -0000, "David Portas"
<RE****************************@acm.org> wrote:
Create a view for each level of access. The view can be limited to just the
required base table columns and calculated values.

See "Using Views as Security Mechanisms" in Books Online.


I have a extra requirement that I create only one view or SP which
will handle all tables for all access levels.

I can dig my way out of that with some extra code, but, the less code
necessary, the better.

Mario.
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Simon G Best | last post: by
2 posts views Thread by Paul Bradford | last post: by
3 posts views Thread by larry mckay | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.