views:

198

answers:

1

I've been trying to find some manual information on this, but my search is fruitless.

I'm trying to see if there is a way to find the unique spid (from sp_who) of a connection into a database from Powerbuilder.

As in, a user logs in, and I can see their sp_who record, but I want to be able to obtain and manipulate this id in the application itself.

(This is probably an easy one. Free rep, pb experts!)

+2  A: 

Well, after trying to google this again this morning (and getting this question as the first result :p) I've found that there's actually a @@SPID variable that I can call.

What I've done is create a procedure

create procedure prc_get_spid
as
begin
return @@spid
end

then in my application I just go

long ll_spid
ll_spid = sqlca.prc_get_spid()

which gives me the spid for the sqlca connection.

^_^

glasnt