Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Using SQL, how can I get the same list as "Connected Users" tab in Sybase Central? (SQL Anywhwere 9.0)

asked 30 Jun '11, 08:53

henginy's gravatar image

accept rate: 0%

I guess

call sa_conn_info()

will give you the desired information - at least partially. Here's the doc for 12.0.1.

permanent link

answered 30 Jun '11, 09:42

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%


Thanks for the pointer. I found sa_conn_activity procedure that does a similar job and altered it to include some other properties I needed.

(04 Jul '11, 02:49) henginy
Replies hidden

I hope by "altered it" you really mean that you defined your own procedure with a different name with similar code? If not, then I highly recommend that you not actually change the definition of dbo.sa_conn_activity() because if you do you will lose your definition (and it will be revert back to the original) if you ever unload/reload your database or do a ALTER DATABASE PROCEDURE ON.

(04 Jul '11, 11:13) Mark Culp

or an "ALTER DATABASE UPGRADE PROCEDURE ON" - yes, one of my current favourites:)

(04 Jul '11, 11:24) Volker Barth

I had to change the actual procedure. Yeah, I know. I tried to define my own but there's a "next_connection" function call inside and I cannot access it in my own procs (is that possible?). Actually this is all about monitoring incoming queries to the server. My .NET program saves a copy of the original definition and pushes its own version. So both versions are safe. There might be a better way to do the same thing, but I haven't come across any yet.

(05 Jul '11, 03:26) henginy

Of course you can use the next_connection() function in your own code - typically in a loop, e.g. something like

declare nConnId integer;
set nConnId = (select next_connection(null));
while nConnId is not null loop
  -- do something with nConnId
  set nConnId = (select next_connection(nConnId));
end loop;
(05 Jul '11, 04:27) Volker Barth
Comment Text Removed

You can type only: select number from sa_conn_info();

(05 Oct '12, 08:19) LGregianin

Sure you can. However, here my point was to show how to use a next_connection() loop...

(05 Oct '12, 08:51) Volker Barth
showing 1 of 7 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 30 Jun '11, 08:53

question was seen: 11,331 times

last updated: 05 Oct '12, 08:51