Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

GET the windows or Operating System loginname using sql server 2005 Expand / Collapse
Author
Message
Posted Monday, April 19, 2010 7:05 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 1:38 AM
Points: 330, Visits: 964
How to get the windows loginname using sql server 2005, for example My system IP Address is 192.191.190.1 i will have to give my loginname and password to connect to my system. The Loginname which i give to connect to the machine need to fetch this loginname using SQL Server 2005 please let me know how to find this.

With Regards
Dakshina Murthy
Post #905937
Posted Monday, April 19, 2010 7:13 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 4:05 PM
Points: 33,165, Visits: 15,299
suser_sname()

http://msdn.microsoft.com/en-US/library/ms174427%28v=SQL.90%29.aspx







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #905940
Posted Monday, April 19, 2010 7:44 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 1:38 AM
Points: 330, Visits: 964
Thanks a lot for the reply, but when i execute the query i will get the systemname or computer name, in our case the computer name will be different and the loginname or the username for OS is different, here in our case, all of us are having the system name like issys320, issys318 etc, but for the issys320 the loginname which i use to login is dakshina i need to track the login dakshina.


With Regards
Dakshina Murthy
Post #905979
Posted Monday, April 19, 2010 7:56 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 5:20 PM
Points: 23,226, Visits: 31,918
Curious. I execute select suser_sname() and it returns my username, not the name of my desktop system from which I have logged into the SQL Server instance.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #905992
Posted Monday, April 19, 2010 8:08 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:26 AM
Points: 2,840, Visits: 3,963
dakshinamurthy-655138 (4/19/2010)
but for the issys320 the loginname which i use to login is dakshina i need to track the login dakshina.
whats your sql windows login ?
can you see that dakshina in
select name , * from sys.syslogins



-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #906010
Posted Monday, April 19, 2010 8:10 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 4:05 PM
Points: 33,165, Visits: 15,299
Sorry, I think I typed too many S's. Old habit from tracking machines too often.

suser_name() should return the security context.
http://msdn.microsoft.com/en-US/library/ms187934%28v=SQL.90%29.aspx







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #906012
Posted Monday, April 19, 2010 8:14 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 1:38 AM
Points: 330, Visits: 964
Hi Bhuvanesh,

here i am loging to SQL Server after loging to my desktop or Laptop PC , now i would like to track the login name which i use to login to the lap top where i have SQL Server 2005 and from there i will connect to my Destination DB.

When i execute the query you gave i will get the information as follows

name sid
sa 0x01

and so on.

With Regards
Dakshina Murthy
Post #906018
Posted Monday, April 19, 2010 8:15 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 1:38 AM
Points: 330, Visits: 964
Hi,

i even tried that, i will ge the login used to connect to sql server, but i am required of the loginname used to connect to my PC or Laptop system


With Regards
Dakshina Murthy
Post #906020
Posted Monday, April 19, 2010 8:16 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:26 AM
Points: 2,840, Visits: 3,963
@Steve

Difference between suser_sname() and suser_name() ?


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #906022
Posted Monday, April 19, 2010 8:21 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 5:20 PM
Points: 23,226, Visits: 31,918
dakshinamurthy-655138 (4/19/2010)
Hi,

i even tried that, i will ge the login used to connect to sql server, but i am required of the loginname used to connect to my PC or Laptop system


With Regards
Dakshina Murthy


Are you using the same user name to connect to SQL Server as your PC or Laptop?



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #906024
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse