Can run sp as Administrator but not as User/dbo

From: Simn (Simn_at_discussions.microsoft.com)
Date: 07/27/05


Date: Wed, 27 Jul 2005 08:34:03 -0700

Anyone any clues? TIA Simn.

I can run the following sp fine in isql (and vb app) when logged in as
Administrator, but not when logged in as a User who has dbo rights in THISDB
(would rather have less..) and public in OTHERDB. Am using Windows auth and
not allowed sql login.
I get the msgs:
=======
Server: Msg 208, Level 16, State 1, Procedure sp_MyPROC, Line (marked below
with X)
Invalid object name 'myTABLE'.
Server: Msg 266, Level 16, State 1, Procedure sp_MyPROC, Line (marked below
with XX)
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK
TRANSACTION statement is missing. Previous count = 0, current count = 1.
=======

================================================
ALTER PROC [dbo].[sp_MyPROC] @myPARAM VARCHAR(30) AS
DECLARE @error_var int
SET @error_var = 999

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id(N'[myTABLE]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
        DECLARE @rowcount_var int
        DECLARE @t1 datetime, @t2 datetime, @t3 datetime

        BEGIN TRANSACTION
        
        SET @t1 = GETDATE()

        CREATE TABLE [myTABLE] (
        [ONE] [varchar] (30) COLLATE Latin1_General_CI_AS NULL ,
X [TWO] [varchar] (50) COLLATE Latin1_General_CI_AS NULL
        ) ON [PRIMARY]

        IF( @@error <> 0 ) SET @error_var = 1

        INSERT INTO [myTABLE]
        SELECT o.[ONE], o.[TWO]
        FROM OTHERDB.dbo.source as o
        INNER JOIN THISDB.dbo.Links as l
        ON o.ONE = l.ONE
        WHERE l.[Name] = @myPARAM

        SELECT @rowcount_var = @@rowcount, @error_var = @@error
        IF( @error_var > 1 ) SET @error_var = 2
        IF( @rowcount_var = 0 ) SET @error_var = 3

        SET @t2 = GETDATE()

        UPDATE [myTABLE] SET
        [ONE]=REPLACE([SBN],'''','`'),
        [TWO]=REPLACE([BNA],'''','`')

        IF( @@error <> 0 ) SET @error_var = 4
        SET @t3 = GETDATE()

        IF( @error_var = 0 )
        BEGIN
                COMMIT TRANSACTION
                INSERT INTO [timing] (RT, param, t1, t2, rc) VALUES (GETDATE(), @myPARAM,
DATEDIFF(s,@t1,@t2), DATEDIFF(s,@t2,@t3), @rowcount_var)
        END
XX ELSE ROLLBACK TRANSACTION

END
ELSE SET @error_var = 99

RETURN @error_var
================================================



Relevant Pages

  • Re: Implementing a privileged IOCTL
    ... Even if the privilege is not enabled by default, any app can turn it on. ... The best way to do what you are doing is to sign your IOCTL request using a key that both the driver and app agrees on. ... None of the standard NT privileges describe my "loading firmware into a device" privilege quite precisely. ... on Windows 2003 I've noticed the Administrator doesn't ...
    (microsoft.public.development.device.drivers)
  • Re: "RUN AS" administartor
    ... they don't need to launch apps as an administrator. ... Microsoft MVP - Terminal Server ... > One solution is to have the user on the console run a TS session within a TS ... >> run the app under a different account. ...
    (microsoft.public.win2000.termserv.apps)
  • Re: Permissions?
    ... Create a Users Group for that App ... > SBS 2003 Standard ... I have tried giving the users administrator ... > network prior to the Installation of SBS 2003. ...
    (microsoft.public.windows.server.sbs)
  • Re: Vista Solutions
    ... Just a pointer that I forgot to put in there but that you apparently caught anyways, but that line goes in the init of the form. ... AFAIK these both work at least as far back as VFP6, although there are other problems with versions before VFP9 if you install in program files and have any files that get written to with your application. ... > Running under administrator doesn't change the order the way components ... >>> run an app as administrator, ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Permissions?
    ... > Hi Tony ... Create a Users Group for that App ... > control of the folder containing the application on the server and each WS ... >> only run under administrator. ...
    (microsoft.public.windows.server.sbs)