Is there a way of finding out what connection level variables are available in a connection - or am I missing something obvious? (In the circumstances I am working with variables may have been created by events or login procedures that I am not aware of - of course I can test for the existance of a particular variable with if varexists(), but I was after a list).

asked 26 Jun '12, 15:51

Justin%20Willey's gravatar image

Justin Willey
accept rate: 21%


FWIW a connection-level variable created by an event is only visible to the event (and any code it calls), so it's not in the same ballpark as a login procedure.

(26 Jun '12, 16:04) Breck Carter

AFAIK Currently there is no easy method to get a list of currently defined connection variables.

Of course the hard method would be to enumerate all possible names of variables and use varexists to see if each exists but that may take a very long time :-)

permanent link

answered 26 Jun '12, 15:54

Mark%20Culp's gravatar image

Mark Culp
accept rate: 40%


...the good part would be that during the check of the full namespace, at least one need not have to worry about connection-level variables being created or deleted in the interim - so the result would be deterministic and would not be affected by other connections:)

(26 Jun '12, 16:17) Volker Barth
Replies hidden

Thanks Mark - I feared that would be the case. I'll just have to ask everyone who might add a mechanism that creates them to let me know. I think I'll have to pass on the alternative mechanism!!

(26 Jun '12, 16:34) Justin Willey
Replies hidden

In case CREATE VARIABLE is logged in the transaction log (which I have not checked for), you might also be able to access that to analyse whether the current connection has executed such a statement. - That's a very cautious might: It seems like a real big hammer, would require according authority, and might not work (if at all) when logic is hidden within I fear it might not be a solution:(

(26 Jun '12, 16:42) Volker Barth

So this would sound like a reasonable enhancement request, Mark?

(26 Jun '12, 16:43) Volker Barth
Replies hidden

With around 1.15 x10^205 possibilities it's the "end of time arrives first" scenario that might outweigh the advantages :) But then again it would get me out of cutting the grass / washing up etc for eternity, so .....

(26 Jun '12, 17:03) Justin Willey

Still you wouldn't have to sigh "Oh, I have to start from scratch again":)

(26 Jun '12, 17:06) Volker Barth

CREATE VARIABLE is no logged in the transaction log.... since there is no permanent database change caused by the statement.

(27 Jun '12, 05:41) Mark Culp

Possibly... but I'm wondering if Justin could just do a grep of the source periodically to determine if any new variables had been created?

(27 Jun '12, 05:42) Mark Culp

Thanks for the clarification - I had thought that a variable could influence query results that might influence DML statements (in case it is used to filter rows, say, for an INSERT SELECT). But obviously, the TL would not log the query itself but the resulting operations, and so the variable is not needed for a "replay"/restore.

Yes, I'm still learning basic stuff:)

(27 Jun '12, 05:46) Volker Barth

Yes - I bet just after he has finished the brute-force namespace query:)

(27 Jun '12, 05:54) Volker Barth
showing 3 of 10 show all flat view

Later update

I have discovered that you can see them if use use the debugger in Sybase Central, in the bottom left-hand window - if you switch to the Global view

alt text

permanent link

answered 26 Aug '12, 17:59

Justin%20Willey's gravatar image

Justin Willey
accept rate: 21%

Now you have to tell us: Did you find this after you

  1. canceled or
  2. finished

the mentioned "brute-force variable namespace query"?

(27 Aug '12, 06:41) Volker Barth
Replies hidden

Luckily I was able to sub-contract the job to some mice who operate in a parallel space-time continuum (dis-continuum??) who only wanted to be paid in cheese.

(28 Aug '12, 10:30) Justin Willey
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: 26 Jun '12, 15:51

question was seen: 861 times

last updated: 28 Aug '12, 10:30