Re: Extended Stored Procedure: Get the current db of the client



No, because then you need to connect first! So what database do you
establish your connection to?
Please don't answer try to answer questions you do not know the answer to.
-GertD

"Mike C#" <xxx@xxxxxxx> wrote in message news:Ga99g.60$Id.19@xxxxxxxxxxx
DBLIB, dbname() function.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_aa-az_2gtz.asp

enjoy

"Gert E.R. Drapers" <GertD@SQLDev@Net> wrote in message
news:u8i0W6WdGHA.4720@xxxxxxxxxxxxxxxxxxxxxxx
Does not matter, an XP does not have a call to retrieve the database
context.
GertD@xxxxxxxxxx

"Mike C#" <xxx@xxxxxxx> wrote in message
news:wzR8g.505$Ut2.124@xxxxxxxxxxx
Works for SP's, might work with XP's as well:

1. Prefix the name with "sp_"
2. Mark it as a system object with sp_MS_MarkSystemObject

This causes the SP to run under the context of the database it was
called from, not the master database where it resides. At the least,
you can put an SP wrapper in the master DB for the XP, and pass in the
db_name() as a parameter to the XP and it will have the correct database
context (not "master").


"Gert E.R. Drapers" <GertD@SQLDev@Net> wrote in message
news:%23ZtUJnzcGHA.3632@xxxxxxxxxxxxxxxxxxxxxxx
This never worked correctly, this is not way you can get the database
context from within an XP, easiest work around is to use a wrapper SP
that passes the db_name() or db_id() as a parameter.

In general using wrapper SP's is a good practice for doing parameter
validation, and meta data exposure since XP's do not emit the parameter
signatures.

GertD@xxxxxxxxxx


"Sue Hoegemeier" <Sue_H@xxxxxxxxxxxxx> wrote in message
news:feuv521gpm893g6hfi4aja0vpp8vguiun4@xxxxxxxxxx
What version of SQL Server?
It's a limitation of extended stored procedure programming
with SQL Server 2000. Some have tried using svr_rpcdb but it
will generally just return master as the database name. And
it's no longer supported.

-Sue

On Mon, 8 May 2006 14:41:59 +0200, "Hans Stoessel"
<hstoessel.list@xxxxxxxxxxxx> wrote:

Hi

Is there a way to get the current database of the client who calls my
Extended Stored Procedure?

I have written a DLL in Visual Studion 2005 for the SQL server 2003 in
C/C++
using the functions srv_*.

Thanks.
Hans












.



Relevant Pages

  • Re: Extended Stored Procedure: Get the current db of the client
    ... This causes the SP to run under the context of the database it was called ... not the master database where it resides. ... easiest work around is to use a wrapper SP that ...
    (microsoft.public.sqlserver.odbc)
  • Re: Extended Stored Procedure: Get the current db of the client
    ... This causes the SP to run under the context of the database it was called ... not the master database where it resides. ... easiest work around is to use a wrapper SP ...
    (microsoft.public.sqlserver.odbc)
  • cdt glossary 0.1.4
    ... This glossary seeks to limit lengthy misunderstandings ... basic database research and mathematics. ... When context matters, it is provided. ... It is /not/ the same as a reference. ...
    (comp.databases.theory)
  • Re: Database design, Keys and some other things
    ... except maybe that a database contains dead objects in the sense then as soon as they are in the database they stop behaving - food for another thread). ... some of their facts to establish that reason. ... to a refutation of the idea that there's any essential difference between the industry standard external identifier and the database-specific surrogate key: it's a matter of context merely, and not anything intrinsic to that data, or how it is managed. ... What is essential to this question is what their nature is. ...
    (comp.databases.theory)
  • Re: Extended Stored Procedure: Get the current db of the client
    ... This causes the SP to run under the context of the database it was called ... not the master database where it resides. ... easiest work around is to use a wrapper SP ...
    (microsoft.public.sqlserver.odbc)