On DB2 how do I query for the current user?
ON Oracle it's "select user from dual;"
Thanx!
Sent via Deja.com http://www.deja.com/
Before you buy.
On DB2 how do I query for the current user?
ON Oracle it's "select user from dual;"
Also how do I get a list of users:
ON Oracle it's "select * from dba_users"
all users? I don't know if that can be done...
HTH,
Mark Arnold
In article <81gj9u$k70$1...@nnrp1.deja.com>,
In DB2 the current user id is "USER"
For example:
CREATE TABLE foo
bar AS CHAR(8) NOT NULL DEFAULT USER;
or also
UPDATE ping SET u = USER WHERE you want to
which is the same as
VALUES(USER)
As of the users list, I have no idea. I'd try to obtain it from the
operating system.
Regards
Juan Lanus
tjm...@my-deja.com wrote:
>
> Hi!
>
> On DB2 how do I query for the current user?
>
> ON Oracle it's "select user from dual;"
>
That's not a clp command and certainly doesn't execute
as a sql statement...
I use ODBC and need to return the USER from a query somehow.
I see from the other post I could create a table and insert the user in
it then select the user and then delete the table but there has to be an
easier faster way doesn't there?!?!
Anyways thanks a lot for your help!
In article <383BFD15...@ca.ibm.com>,
You can also return a function this way right?
select myfunct() from sysibm.sysdummy1
Thanks
In article <81h235$v6s$1...@nnrp1.deja.com>,
Mark Arnold <mark_...@excite.com> wrote:
> On DB2/OS390 anyway, "select current sqlid from sysibm.sysdummy1"
> or (in program code) "SET :var-name = current sqlid"
>
> all users? I don't know if that can be done...
>
> HTH,
> Mark Arnold
>
> In article <81gj9u$k70$1...@nnrp1.deja.com>,
> tjm...@my-deja.com wrote:
> > Hi Agin let me add to this!
> >
> > On DB2 how do I query for the current user?
> > ON Oracle it's "select user from dual;"
> >
> > Also how do I get a list of users:
> > ON Oracle it's "select * from dba_users"
select user from sysibm.sysdummy1
(SYSIBM.SYSDUMMY1 is a 1 row table supplied with DB2, like DUAL in Oracle.)
tjm...@my-deja.com wrote:
> Thanks for the reply...
> But what do you mean by:
> "db2 values user"
>
> That's not a clp command and certainly doesn't execute
> as a sql statement...
>
> I use ODBC and need to return the USER from a query somehow.
> I see from the other post I could create a table and insert the user in
> it then select the user and then delete the table but there has to be an
> easier faster way doesn't there?!?!
>
> Anyways thanks a lot for your help!
>
> In article <383BFD15...@ca.ibm.com>,
> adam...@nopamca.ibm.com wrote:
> > db2 values user
> >
> > tjm...@my-deja.com wrote:
> >
> > > Hi!
> > >
> > > On DB2 how do I query for the current user?
> > >
> > > ON Oracle it's "select user from dual;"
> > >
As for your previous question, there's no way to get a list of "all users"
as you can in Oracle. With DB2, security is more integrated with the
operating system (eg. Unix,NT) than it is with Oracle. Users do not get
defined to DB2, instead any valid Unix/NT user can sign onto the DB2 system
(as long as they have Connect authority).
Phil Castle.
SELECT user from Tablename>.
Use the special register in the select-list.
Regards
Alfred
tjm...@my-deja.com schrieb:
> Hi Agin let me add to this!
>
> On DB2 how do I query for the current user?
> ON Oracle it's "select user from dual;"
>
> Also how do I get a list of users:
> ON Oracle it's "select * from dba_users"
>
> Thanx!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Viele Grüße
Alfred Moos
--
Fachhochschule Heidelberg - University of Applied Sciences
http://www.fh-heidelberg.de/fb/info/mitarb/moos.htm
Neu: Europäischer Computer-Führerschein (ECDL):
http://www.fh-heidelberg.de/public/moos/ecdl.htm
tjm...@my-deja.com wrote:
> Hi!
>
> On DB2 how do I query for the current user?
>
> ON Oracle it's "select user from dual;"
>
> On DB2 how do I query for the current user?
> ON Oracle it's "select user from dual;"
In db2 run the command (from a command window) db2 "values(user)" to get the
current user.
>
>
> Also how do I get a list of users:
> ON Oracle it's "select * from dba_users"
It depends upon what you want here:
To get a list of active users running applications against the database do a
"db2 list applications' command..among other things, this will return the
authid of all users currently rnning applications
To get a list of users authorized to use the database use the command:
"db2 select grantee from syscat.dbauth"...to see what authorities the users
have just do a "db2 select * from syscat.dbauth"
You can also easily check authorities from the control center.
Regards...Marc Baime
the itcontractor wrote:
> tjm...@my-deja.com wrote:
>
> > Hi!
> >
> > On DB2 how do I query for the current user?
> >
> > ON Oracle it's "select user from dual;"
> >