Link to home
Start Free TrialLog in
Avatar of QPR
QPRFlag for New Zealand

asked on

The specified schema name "sys" either does not exist or you do not have permission to use it.

Not sure why this would appear.
I am trying to create a sproc in a user db. This sproc calls master.sys.xp_readerrorlog
I am SA on the server.

Have I got my path wrong (mater.sys.....) or is SA <> SA in 2000?!
Avatar of i2mental
i2mental
Flag of United States of America image

try

master..sys.xp_readerrorlog

or

master.dbo.sys.xp_readerrorlog

Avatar of QPR

ASKER

exactly the same error (tried both versions)

BEGIN

   IF (NOT IS_SRVROLEMEMBER(N'securityadmin') = 1)
   BEGIN
      RAISERROR(15003,-1,-1, N'securityadmin')
      RETURN (1)
   END
   
   IF (@p2 IS NULL)
       EXEC master..sys.xp_readerrorlog @p1
   ELSE
       EXEC master..sys.xp_readerrorlog @p1,@p2,@p3,@p4
END
Avatar of QPR

ASKER

ok red herring.
It was actually the create sp line (line 1) that was wrong even though the error claimed to be on line 31

CREATE PROC [sys].[sp_readerrorlog]
needed to be
CREATE PROC [sp_readerrorlog]

I was creating the sproc in a user db (not master)
I copied the code word for word from this article.....
http://www.mssqltips.com/tip.asp?tip=1476

Do you know why I got the error
ASKER CERTIFIED SOLUTION
Avatar of i2mental
i2mental
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of QPR

ASKER

Good info, thanks.
The author of the article had it as
[sys].[sp_readerrorlog]