Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    Brussels
    Posts
    57

    Unanswered: how to retreive dbname in proc

    In a stored procedure i want to know in which database the procedure is working ? how can we retreive this name ?
    Why :
    we're using same procedure in logged and non logged db.
    in logged we've has to use transaction : begin-commit-rollback, in non logged we get error -256 when used;
    If we know the database of the procedure we could retreive column is_logging from sysmaster:sysdatabases for that database and make a variable syntax in the SPL. like "if logging = 1 then begin work ; end if;"

    someone can help ?
    thanks
    Yves & Willy

  2. #2
    Join Date
    Dec 2003
    Location
    North America
    Posts
    146
    Hi,

    Perhaps this may help.

    If you're using IDS, you can issue "onstat -u" & determine (by user) which thread(s) that user is executing. With this user information you can determine the sessid(s) of the thread(s).

    Then issue "onstat -g sql <sessid>" and the current SQL being executed is displayed along with the current database name.

  3. #3
    Join Date
    Nov 2004
    Posts
    26
    I think this works;

    select sdbs.* { is_logging }
    from sysmaster:syssessions sess,
    sysmaster:syslocks slocks,
    sysmaster:sysdatabases sdbs
    where sess.sid = DBINFO('sessionid')
    and sess.sid = slocks.owner
    and slocks.rowidlk = sdbs.rowid
    and sdbs.name != "sysmaster"

  4. #4
    Join Date
    Apr 2004
    Location
    Brussels
    Posts
    57
    yes, that's it,

    with "select sdbs.is_logging into is_logging .... "
    it works fine.

    Thanks
    Yves & Willy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •