[dba-SQLServer] Finding current login group

David Emerson davide at dalyn.co.nz
Wed Jul 7 13:49:57 CDT 2004


Thanks Robert but that produces "Incorrect syntax near the keyword 'exec'." 
error

David

At 7/07/2004, you wrote:
>David,
>
>Just a WAG here, but I think you might be able to do this...
>
>DECLARE @sys_usr varchar(100), @qs nvarchar(4000)
>SET @sys_usr = SYSTEM_USER
>SELECT @qs = (exec master..xp_logininfo @sys_usr)
>
>At 12:00 PM 07/07/2004 -0500, you wrote:
>>Date: Wed, 07 Jul 2004 04:58:32 +1200
>>From: David Emerson <davide at dalyn.co.nz>
>>Subject: RE: [dba-SQLServer] Finding current login group
>>To: dba-sqlserver at databaseadvisors.com
>>Message-ID: <5.2.0.9.0.20040707042050.00b2baf0 at mail.dalyn.co.nz>
>>Content-Type: text/plain; charset="us-ascii"; format=flowed
>>
>>Thanks Francis,
>>
>>This also returns egas\david which is the Windows user.  I am after
>>egas\BillingManager which is the windows group that egas\david belongs to
>>which is the login.
>>
>>I am close.  Here is the latest -
>>
>>Billy Pang provided me with the following:
>>
>>DECLARE @sys_usr varchar(100)
>>SET @sys_usr = SYSTEM_USER
>>EXEC master..xp_logininfo @sys_usr
>>
>>When this is run in Query Analyser I get the correct recordset with a
>>column called Permission Path.  This has the data in it (in this case
>>'egas\BillingManager').
>>
>>I want to turn this into a sproc which returns the value of Permission
>>Path.  What I have so far is -
>>
>>ALTER PROCEDURE dbo.spGetCurrentUser
>>
>>DECLARE @sys_usr varchar(100), @qs nvarchar(4000)
>>SET @sys_usr = SYSTEM_USER
>>EXEC master..xp_logininfo @sys_usr
>>
>>When run the sproc from query analyzer I get the recordset.  Now, how do I
>>change the sproc so that it returns the value of the permission path column?
>>
>>David
>
>
>




More information about the dba-SQLServer mailing list