Is it possible to get the machine name in a trigger so that it can be stored
in a field?
Thanks.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.com> wrote in message
news:N1vTd.5219$873.4670@.newsread3.news.pas.earthlink.net...
Is it possible to get the machine name in a trigger so that it can be stored
in a field?
Thanks.|||Great. Thanks.
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OjjQtktGFHA.4032@.TK2MSFTNGP12.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.pinnaclepublishing.com
> .
> "Neil" <njones@.pxdy.com> wrote in message
> news:N1vTd.5219$873.4670@.newsread3.news.pas.earthlink.net...
> Is it possible to get the machine name in a trigger so that it can be
> stored
> in a field?
> Thanks.
>|||Any function for getting the current Windows user?
Thanks!
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OjjQtktGFHA.4032@.TK2MSFTNGP12.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.pinnaclepublishing.com
> .
> "Neil" <njones@.pxdy.com> wrote in message
> news:N1vTd.5219$873.4670@.newsread3.news.pas.earthlink.net...
> Is it possible to get the machine name in a trigger so that it can be
> stored
> in a field?
> Thanks.
>|||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.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"Neil" <njones@.pxdy.com> wrote in message
news:6_xTd.5362$873.4937@.newsread3.news.pas.earthlink.net...
> Any function for getting the current Windows user?
> Thanks!
>
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:OjjQtktGFHA.4032@.TK2MSFTNGP12.phx.gbl...
>|||Here's what I got:
ID Login Name
User Name
-- ---
---
----
----9 bo(1 row(s) af
fected)I was looking for the Windows account that's currently logged in, if
that'spossible.Thanks."Vin
od Kumar" <vinodk_sct@.NO_SPAM_hotmail.com> wrote in messagenews:cvmtl9$ufs$1@.news01.int
el.com...> Check if this helps:>> SELECT @.@.SPID AS 'ID', SYSTEM_USER AS 'Login Name', U
SER AS 'User Name'>> --> HTH,> Vinod Kumar> MCSE, DBA, MCAD, MCSD> http://www.ext[
/url]
.../2000/books.asp>> "Neil" <njones@.pxdy.com> wrote in mess
age> news:6_xTd.5362$873.4937@.newsread3.news.pas.earthlink.net...>> Any func
tion for getting the
current Windows user?>>>> Thanks!>>>>>> "Tom Moreau" <tom@.dont.spam.me.cips.
ca> wrote in message>> news:OjjQtktGFHA.4032@.TK2MSFTNGP12.phx.gbl...>> > Che
ck out HOST_NAME() in the BOL.>> >>> > -->> > Tom>> >>> > --
--
-->> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA>> > SQL Server MVP>> > Columnist,
SQL Server Professional>> > Toronto, ON Canada>> > [url]www.pinnaclepublishing.com[/
url]>> > .>> > "Neil" <njones@.pxdy.com> wrote in message>> > news:N1vTd.5219
$873.4670@.newsre
ad3.news.pas.earthlink.net...>> > Is it possible to get the machine name in
a trigger so that it can be>> > stored>> > in a field?>> >>> > Thanks.>> >>>
>>>>>>>|||try suser_sname()
dean
"Neil" <njones@.pxdy.com> wrote in message
news:wGAUd.7684$873.5789@.newsread3.news.pas.earthlink.net...
> Here's what I got:
> ID Login Name
> User Name
> -- ---
---
> ----
----9 bo(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.com>
wrote in messagenews:cvmtl9$ufs$1@.news01.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.extremeexperts.com>> Books Online for SQL Server SP3 at>
http://www.microsoft.com/sql/techin.../2000/books.asp>> "Neil"
<njones@.pxdy.com> wrote in message>
news:6_xTd.5362$873.4937@.newsread3.news.pas.earthlink.net...>> Any function
for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
<tom@.dont.spam.me.cips.ca> wrote in message>>
news:OjjQtktGFHA.4032@.TK2MSFTNGP12.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.pinnaclepublishing.com>> > .>>
> "Neil" <njones@.pxdy.com> wrote in message>> >
news:N1vTd.5219$873.4670@.newsread3.news.pas.earthlink.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.com) writes:
> Here's what I got:
> ID Login Name
> User Name
>----
>9 bo(1 row(s) affected)
>I was looking for the Windows account that's currently logged in, if
>that'spossible.
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@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Still get "sa".
"Dean" <dvitner@.nospam.gmail.com> wrote in message
news:uiV8mSZHFHA.2420@.TK2MSFTNGP14.phx.gbl...
> try suser_sname()
> dean
> "Neil" <njones@.pxdy.com> wrote in message
> news:wGAUd.7684$873.5789@.newsread3.news.pas.earthlink.net...
> ---
> ----9 bo(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.com>
> wrote in messagenews:cvmtl9$ufs$1@.news01.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.extremeexperts.com>> Books Online for SQL Server SP3 at>
> http://www.microsoft.com/sql/techin.../2000/books.asp>> "Neil"
> <njones@.pxdy.com> wrote in message>
> news:6_xTd.5362$873.4937@.newsread3.news.pas.earthlink.net...>> Any
> function
> for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
> <tom@.dont.spam.me.cips.ca> wrote in message>>
> news:OjjQtktGFHA.4032@.TK2MSFTNGP12.phx.gbl...>> > Check out HOST_NAME() in
> the BOL.>> >>> > -->> > Tom>> >>>
> BSc, PhD, MCSE, MCDBA>> > SQL Server MVP>> > Columnist, SQL Server
> Professional>> > Toronto, ON Canada>> > www.pinnaclepublishing.com>> >
> .>>
> news:N1vTd.5219$873.4670@.newsread3.news.pas.earthlink.net...>> > Is it
> possible to get the machine name in a trigger so that it can be>> >
> stored>>
>|||I was hoping there was a way to use a Windows API call or other, even with
SQL authentication.
Neil
"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns960C1AF7BCEYazorman@.127.0.0.1...
> Neil (njones@.pxdy.com) writes:
> 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@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment