Please look at following code:
use mybase
select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from
master.dbo.sysobjects where name=N'xp_myxp'
use master
select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from
master.dbo.sysobjects where name=N'xp_myxp'
When OBJECTPROPERTY is called from mybase it returns NULL. When it is
called from master it returns 1. Why?Hello, Igor
According to the Books Online, OBJECTPROPERTY expects an ID of an
"object in the current database".
Razvan|||Object id values are not unique within a server. So, when you are in the
context of mybase, the value passed to objectproperty is from that database.
So if you had an object with the same ID as xp_myxp you would have gotten a
result, though not the one you would have liked.
You might be able to get away with using the xtype column from sysobjects to
answer your queries question, since extended procs are of type X.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Igor Solodovnikov" <IgorSolodovnikov@.discussions.microsoft.com> wrote in
message news:op.s3uc9fcvn8ihmu@.iw2k.helpmicro.local...
> Please look at following code:
> use mybase
> select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from
> master.dbo.sysobjects where name=N'xp_myxp'
> use master
> select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from
> master.dbo.sysobjects where name=N'xp_myxp'
> When OBJECTPROPERTY is called from mybase it returns NULL. When it is
> called from master it returns 1. Why?
Monday, February 20, 2012
OBJECTPROPERTY question
Labels:
codeuse,
database,
dbo,
following,
frommaster,
isextendedproc,
microsoft,
mybaseselect,
mysql,
objectproperty,
oracle,
server,
sql,
sysobjects
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment