----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
..
"Neil" <njones@pxdy.co m> wrote in message
news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net...
Is it possible to get the machine name in a trigger so that it can be stored
in a field?
"Tom Moreau" <tom@dont.spam. me.cips.ca> wrote in message
news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl...[color=blue]
> Check out HOST_NAME() in the BOL.
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinnaclepublishing.com
> .
> "Neil" <njones@pxdy.co m> wrote in message
> news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net...
> Is it possible to get the machine name in a trigger so that it can be
> stored
> in a field?
>
> Thanks.
>
>[/color]
Any function for getting the current Windows user?
Thanks!
"Tom Moreau" <tom@dont.spam. me.cips.ca> wrote in message
news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl...[color=blue]
> Check out HOST_NAME() in the BOL.
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinnaclepublishing.com
> .
> "Neil" <njones@pxdy.co m> wrote in message
> news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net...
> Is it possible to get the machine name in a trigger so that it can be
> stored
> in a field?
>
> Thanks.
>
>[/color]
Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.
"Neil" <njones@pxdy.co m> wrote in message
news:6_xTd.5362 $873.4937@newsr ead3.news.pas.e arthlink.net...[color=blue]
> Any function for getting the current Windows user?
>
> Thanks!
>
>
> "Tom Moreau" <tom@dont.spam. me.cips.ca> wrote in message
> news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl...[color=green]
> > Check out HOST_NAME() in the BOL.
> >
> > --
> > Tom
> >
> > ----------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Columnist, SQL Server Professional
> > Toronto, ON Canada
> > www.pinnaclepublishing.com
> > .
> > "Neil" <njones@pxdy.co m> wrote in message
> > news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net...
> > Is it possible to get the machine name in a trigger so that it can be
> > stored
> > in a field?
> >
> > Thanks.
> >
> >[/color]
>
>[/color]
ID Login Name
User Name
------ --------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------9 sadbo(1 row(s) affected)I was looking for the Windows account that's currently logged in, if that'spossible. Thanks."Vinod Kumar" <vinodk_sct@NO_ SPAM_hotmail.co m> wrote in messagenews:cvm tl9$ufs$1@news0 1.intel.com...> Check if this helps:>> SELECT @@SPID AS 'ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name'>> --> HTH,> Vinod Kumar> MCSE, DBA, MCAD, MCSD> http://www.extremeexpe rts.com>> Books Online for SQL Server SP3 at> http://www.microsoft.c om/sql/techinfo/productdoc/2000/books.asp>> "Neil" <njones@pxdy.co m> wrote in message> news:6_xTd.5362 $873.4937@newsr ead3.news.pas.e arthlink.net... >> Any function for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau" <tom@dont.spam. me.cips.ca> wrote in message>> news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl... >> > Check out HOST_NAME() in the BOL.>> >>> > -->> > Tom>> >>> > ---------------------------------------------------->> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA>> > SQL Server MVP>> > Columnist, SQL Server Professional>> > Toronto, ON Canada>> > www.pinnaclepub lishing.com>> > .>> > "Neil" <njones@pxdy.co m> wrote in message>> > news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net... >> > Is it possible to get the machine name in a trigger so that it can be>> > stored>> > in a field?>> >>> > Thanks.>> >>> >>>>>>>
"Neil" <njones@pxdy.co m> wrote in message
news:wGAUd.7684 $873.5789@newsr ead3.news.pas.e arthlink.net...[color=blue]
> Here's what I got:
>
> ID Login Name
> User Name
> ------ -------------------------------------------------------------------[/color]
-------------------------------------------------------------[color=blue]
> -------------------------------------------------------------------------[/color]
-------------------------------------------------------9 sadbo(1 row(s)
affected)I was looking for the Windows account that's currently logged in,
if that'spossible. Thanks."Vinod Kumar" <vinodk_sct@NO_ SPAM_hotmail.co m>
wrote in messagenews:cvm tl9$ufs$1@news0 1.intel.com...> Check if this
helps:>> SELECT @@SPID AS 'ID', SYSTEM_USER AS 'Login Name', USER AS 'User
Name'>> --> HTH,> Vinod Kumar> MCSE, DBA, MCAD, MCSD>
http://www.extremeexpe rts.com>> Books Online for SQL Server SP3 at>
http://www.microsoft.c om/sql/techinfo/productdoc/2000/books.asp>> "Neil"
<njones@pxdy.co m> wrote in message>
news:6_xTd.5362 $873.4937@newsr ead3.news.pas.e arthlink.net... >> Any function
for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
<tom@dont.spam. me.cips.ca> wrote in message>>
news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl... >> > Check out HOST_NAME() in
the BOL.>> >>> > -->> > Tom>> >>>[color=blue]
> ---------------------------------------------------->> > Thomas A. Moreau,[/color]
BSc, PhD, MCSE, MCDBA>> > SQL Server MVP>> > Columnist, SQL Server
Professional>> > Toronto, ON Canada>> > www.pinnaclepub lishing.com>> > .>>[color=blue]
> "Neil" <njones@pxdy.co m> wrote in message>> >[/color]
news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net... >> > Is it
possible to get the machine name in a trigger so that it can be>> > stored>>[color=blue]
> in a field?>> >>> > Thanks.>> >>> >>>>>>>
>[/color]
Neil (njones@pxdy.co m) writes:[color=blue]
> Here's what I got:
>
> ID Login Name
> User Name
>-------------------------------------------------------
>9 sadbo(1 row(s) affected)
>I was looking for the Windows account that's currently logged in, if
>that'spossible .[/color]
It appears that the user has logged in through SQL authentication. In
that case you cannot retrieve the Windows user. In fact, the user
may not even have been authenticated through Windows - he might be
accessing SQL Server from a Unix box.
Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.
"Dean" <dvitner@nospam .gmail.com> wrote in message
news:uiV8mSZHFH A.2420@TK2MSFTN GP14.phx.gbl...[color=blue]
> try suser_sname()
>
> dean
>
> "Neil" <njones@pxdy.co m> wrote in message
> news:wGAUd.7684 $873.5789@newsr ead3.news.pas.e arthlink.net...[color=green]
>> Here's what I got:
>>
>> ID Login Name
>> User Name
>> ------ -------------------------------------------------------------------[/color]
> -------------------------------------------------------------[color=green]
>> -------------------------------------------------------------------------[/color]
> -------------------------------------------------------9 sadbo(1
> row(s)
> affected)I was looking for the Windows account that's currently logged in,
> if that'spossible. Thanks."Vinod Kumar" <vinodk_sct@NO_ SPAM_hotmail.co m>
> wrote in messagenews:cvm tl9$ufs$1@news0 1.intel.com...> Check if this
> helps:>> SELECT @@SPID AS 'ID', SYSTEM_USER AS 'Login Name', USER AS 'User
> Name'>> --> HTH,> Vinod Kumar> MCSE, DBA, MCAD, MCSD>
> http://www.extremeexpe rts.com>> Books Online for SQL Server SP3 at>
> http://www.microsoft.c om/sql/techinfo/productdoc/2000/books.asp>> "Neil"
> <njones@pxdy.co m> wrote in message>
> news:6_xTd.5362 $873.4937@newsr ead3.news.pas.e arthlink.net... >> Any
> function
> for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
> <tom@dont.spam. me.cips.ca> wrote in message>>
> news:OjjQtktGFH A.4032@TK2MSFTN GP12.phx.gbl... >> > Check out HOST_NAME() in
> the BOL.>> >>> > -->> > Tom>> >>>[color=green]
>> ---------------------------------------------------->> > Thomas A.
>> Moreau,[/color]
> BSc, PhD, MCSE, MCDBA>> > SQL Server MVP>> > Columnist, SQL Server
> Professional>> > Toronto, ON Canada>> > www.pinnaclepub lishing.com>> >
> .>>[color=green]
>> "Neil" <njones@pxdy.co m> wrote in message>> >[/color]
> news:N1vTd.5219 $873.4670@newsr ead3.news.pas.e arthlink.net... >> > Is it
> possible to get the machine name in a trigger so that it can be>> >
> stored>>[color=green]
>> in a field?>> >>> > Thanks.>> >>> >>>>>>>
>>[/color]
>
>[/color]
I was hoping there was a way to use a Windows API call or other, even with
SQL authentication.
Neil
"Erland Sommarskog" <esquel@sommars kog.se> wrote in message
news:Xns960C1AF 7BCEYazorman@12 7.0.0.1...[color=blue]
> Neil (njones@pxdy.co m) writes:[color=green]
>> Here's what I got:
>>
>> ID Login Name
>> User Name
>>-------------------------------------------------------
>>9 sadbo(1 row(s) affected)
>>I was looking for the Windows account that's currently logged in, if
>>that'spossibl e.[/color]
>
> It appears that the user has logged in through SQL authentication. In
> that case you cannot retrieve the Windows user. In fact, the user
> may not even have been authenticated through Windows - he might be
> accessing SQL Server from a Unix box.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinf...2000/books.asp[/color]
But how do you expect to get the Windows login when it is not a Windows
login in use but a SQL login? Do you mean the user account used on the
client (as opposed to the server)? If that's what you mean then you're
out of luck because SQL Server only knows what it's been told. That is,
the SQL Server doesn't really know anything about the client. As Erland
said, you don't even know what OS the client is running.
Neil wrote:
[color=blue]
>I was hoping there was a way to use a Windows API call or other, even with
>SQL authentication.
>
>Neil
>
>"Erland Sommarskog" <esquel@sommars kog.se> wrote in message
>news:Xns960C1A F7BCEYazorman@1 27.0.0.1...
>
>[color=green]
>>Neil (njones@pxdy.co m) writes:
>>
>>[color=darkred]
>>>Here's what I got:
>>>
>>>ID Login Name
>>>User Name
>>>-------------------------------------------------------
>>>9 sadbo(1 row(s) affected)
>>>I was looking for the Windows account that's currently logged in, if
>>>that'spossib le.
>>>
>>>[/color]
>>It appears that the user has logged in through SQL authentication. In
>>that case you cannot retrieve the Windows user. In fact, the user
>>may not even have been authenticated through Windows - he might be
>>accessing SQL Server from a Unix box.
>>
>>--
>>Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se
>>
>>Books Online for SQL Server SP3 at
>>http://www.microsoft.com/sql/techinf...2000/books.asp
>>
>>[/color]
>
>
>
>[/color]
Comment