473,378 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Machine Name In Trigger

Is it possible to get the machine name in a trigger so that it can be stored
in a field?

Thanks.
Jul 23 '05 #1
10 4750
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" <nj****@pxdy.com> wrote in message
news:N1*****************@newsread3.news.pas.earthl ink.net...
Is it possible to get the machine name in a trigger so that it can be stored
in a field?

Thanks.
Jul 23 '05 #2
Great. Thanks.

"Tom Moreau" <to*@dont.spam.me.cips.ca> wrote in message
news:Oj**************@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" <nj****@pxdy.com> wrote in message
news:N1*****************@newsread3.news.pas.earthl ink.net...
Is it possible to get the machine name in a trigger so that it can be
stored
in a field?

Thanks.

Jul 23 '05 #3
Any function for getting the current Windows user?

Thanks!
"Tom Moreau" <to*@dont.spam.me.cips.ca> wrote in message
news:Oj**************@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" <nj****@pxdy.com> wrote in message
news:N1*****************@newsread3.news.pas.earthl ink.net...
Is it possible to get the machine name in a trigger so that it can be
stored
in a field?

Thanks.

Jul 23 '05 #4
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/techinf...2000/books.asp

"Neil" <nj****@pxdy.com> wrote in message
news:6_*****************@newsread3.news.pas.earthl ink.net...
Any function for getting the current Windows user?

Thanks!
"Tom Moreau" <to*@dont.spam.me.cips.ca> wrote in message
news:Oj**************@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" <nj****@pxdy.com> wrote in message
news:N1*****************@newsread3.news.pas.earthl ink.net...
Is it possible to get the machine name in a trigger so that it can be
stored
in a field?

Thanks.


Jul 23 '05 #5
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.Thanks."Vinod Kumar" <vinodk_sct@NO_SPAM_hotmail.com> wrote in messagenews:cv**********@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/techinfo/productdoc/2000/books.asp>> "Neil" <nj****@pxdy.com> wrote in message> news:6_*****************@newsread3.news.pas.earthl ink.net...>> Any function for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau" <to*@dont.spam.me.cips.ca> wrote in message>> news:Oj**************@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" <nj****@pxdy.com> wrote in message>> > news:N1*****************@newsread3.news.pas.earthl ink.net...>> > Is it possible to get the machine name in a trigger so that it can be>> > stored>> > in a field?>> >>> > Thanks.>> >>> >>>>>>>

Jul 23 '05 #6
try suser_sname()

dean

"Neil" <nj****@pxdy.com> wrote in message
news:wG*****************@newsread3.news.pas.earthl ink.net...
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.Thanks."Vinod Kumar" <vinodk_sct@NO_SPAM_hotmail.com>
wrote in messagenews:cv**********@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/techinfo/productdoc/2000/books.asp>> "Neil"
<nj****@pxdy.com> wrote in message>
news:6_*****************@newsread3.news.pas.earthl ink.net...>> Any function
for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
<to*@dont.spam.me.cips.ca> wrote in message>>
news:Oj**************@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" <nj****@pxdy.com> wrote in message>> > news:N1*****************@newsread3.news.pas.earthl ink.net...>> > Is it
possible to get the machine name in a trigger so that it can be>> > stored>> in a field?>> >>> > Thanks.>> >>> >>>>>>>

Jul 23 '05 #7
Neil (nj****@pxdy.com) writes:
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.


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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #8
Still get "sa".
"Dean" <dv*****@nospam.gmail.com> wrote in message
news:ui**************@TK2MSFTNGP14.phx.gbl...
try suser_sname()

dean

"Neil" <nj****@pxdy.com> wrote in message
news:wG*****************@newsread3.news.pas.earthl ink.net...
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.Thanks."Vinod Kumar" <vinodk_sct@NO_SPAM_hotmail.com>
wrote in messagenews:cv**********@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/techinfo/productdoc/2000/books.asp>> "Neil"
<nj****@pxdy.com> wrote in message>
news:6_*****************@newsread3.news.pas.earthl ink.net...>> Any
function
for getting the current Windows user?>>>> Thanks!>>>>>> "Tom Moreau"
<to*@dont.spam.me.cips.ca> wrote in message>>
news:Oj**************@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" <nj****@pxdy.com> wrote in message>> >

news:N1*****************@newsread3.news.pas.earthl ink.net...>> > Is it
possible to get the machine name in a trigger so that it can be>> >
stored>>
in a field?>> >>> > Thanks.>> >>> >>>>>>>


Jul 23 '05 #9
I was hoping there was a way to use a Windows API call or other, even with
SQL authentication.

Neil

"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn********************@127.0.0.1...
Neil (nj****@pxdy.com) writes:
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.


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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 23 '05 #10
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.

--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mi**********@mallesons.nospam.com |* W* http://www.mallesons.com

Neil wrote:
I was hoping there was a way to use a Windows API call or other, even with
SQL authentication.

Neil

"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn********************@127.0.0.1...

Neil (nj****@pxdy.com) writes:

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.

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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp



Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Leonardo Almeida | last post by:
Hi, I have two tables in differents databases : Master database : ServerInformation where there is a table called "Clientes" and Table "Documentos" in the Database Index2003 What I need to do...
6
by: Michael Spiegel | last post by:
Hi, I have a stored procedure that needs to know the name of the table from which it is called. If you are familiar with a "this" pointer in Java or C++, that's very similar to what I need. I...
3
by: WM Chung | last post by:
Hello all, My dotnet application configuration is that the client, Web server and database all reside in 3 different computers. There is a function which can browse a file and read in the...
3
by: Sty | last post by:
Hi, I have a webapplication, which shows images in directories. There are different sub directories and you can change the directory by a pull down list. If I change the name of a directory, the...
1
by: aj | last post by:
DB2 LUW latest & greatest 8.2 FP11 Is there any way to dynamically reference the table and/or column name in a trigger body, perhaps w/ a special register or something? SP WRITE_AT() is...
5
by: sz07 | last post by:
Hello every one. I am a new member. Sorry if I sound silly. Can anybody give me some ideas on how to trigger an windows application in an unix machine? e.g., how can I send an message from an unix...
1
by: Steven P | last post by:
Hi, In my project I have a timer-driven state machine. The timer object are in the form. Update of controls like edit, label will be executed in some states. The state machine is in a seperate...
2
by: mrkinsopo | last post by:
Here's my simple Trigger to lauch a sp in SQL2000: CREATE TRIGGER trExample ON TABLE_1 FOR INSERT AS if TABLE_1.FIELD_1 ='Some Value' begin declare @widget_id varchar(20) select...
4
by: Astley Le Jasper | last post by:
I have an application that put on an old machine with a fresh Xubuntu installation (with Python 2.5). But I can't get the threading to work The application was written on a combination of Windows...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.