cancel
Showing results for 
Search instead for 
Did you mean: 

how to get client IP or host name or program name in stored procedure?

Former Member
0 Kudos

Suppose I run a sp for sybase ase. Firstly I need to connect to ase with specific loginname, then I have spid for this session. sp_who can give me the ip/hostname/programname.

then with this spid, I can myproc.  Question: within myproc code, can I get the ip/hostname/programname with current spid? any function or system sp for this purpose?

Accepted Solutions (1)

Accepted Solutions (1)

Try this:

select ipaddr, hostname, program_name from master..sysprocesses where spid = @@spid

Answers (1)

Answers (1)

Former Member
0 Kudos

I have a small write up on a similar issue over at Stack Exchange.

sql - Sybase sp_who truncates hostname - Stack Overflow