+ Reply to Thread
Results 1 to 4 of 4

Thread: Username Question

  1. #1
    Barn Enthusiast Flam is an unknown quantity at this point Flam's Avatar
    Join Date
    Dec 2008
    Posts
    249
    Rep Power
    4

    Username Question

    I've been slightly perplexed at the results of the following query depending on where I'm running it from:

    SELECT spid, nt_username
    FROM sys.sysprocesses
    where spid=@@spid

    (I realize I can run SUSER_Name() as well as a variety of other username functions, this is just an example)

    Anyway, I have 2 different modules for an application. Both of them run on the same database, just out of different ports on the server. They run from SQL Server 2005. Both modules have their own built-in query executors (limited functionality; select statements only).

    The thing that confuses me is that if I run the aforementioned query, one module always returns the nt_username value=the local machine username
    while the other module returns tthe nt_username=the admin security group in SQL Server.

    So for example, the results from module 1 of the above query might be:

    SPID nt_username
    55 FLAM

    while the results of module 2 might be:

    SPID nt_username
    62 T_Admin

    I'm not sure if this is something on the application or something I can change in SQL Server.

    Anyone have any ideas?

    Thanks much!

  2. #2
    I like Data Cubes too... Lauramc has a spectacular aura about Lauramc has a spectacular aura about Lauramc's Avatar
    Join Date
    Mar 2008
    Location
    Far Far Away
    Posts
    387
    Real Name
    Laura
    Rep Power
    5

    My only guess on this is that the first module is set to use Windows Authentication, while the second uses SQL server authentication. Therefore, the user login would be different.
    "The Enrichment Center is required to remind you that first you will be baked, then there will be cake." - GLaDOS

  3. #3
    Barn Enthusiast Flam is an unknown quantity at this point Flam's Avatar
    Join Date
    Dec 2008
    Posts
    249
    Rep Power
    4

    Yeah, I was afraid of that...over my head though... Thanks!

  4. #4
    I like Data Cubes too... Lauramc has a spectacular aura about Lauramc has a spectacular aura about Lauramc's Avatar
    Join Date
    Mar 2008
    Location
    Far Far Away
    Posts
    387
    Real Name
    Laura
    Rep Power
    5

    If I can make it easier to digest let me know! You can always PM me!
    "The Enrichment Center is required to remind you that first you will be baked, then there will be cake." - GLaDOS

+ Reply to Thread

Similar Threads

  1. Show Username is report
    By randheer in forum SQL Server Reporting Services Help
    Replies: 4
    Last Post: August 18th, 2010, 09:59 AM
  2. Function USerName(ID)
    By Shem in forum .NET Development
    Replies: 25
    Last Post: July 8th, 2008, 11:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO