To get a SYSTEM NAME even using sa or Group login other than Windows Authentication

how to get system name in username when we write a select query Select SUser_sname() in sql server 2008 r2.
Actually , requirement  is  I have to give a sql serevr login to the client.
NOTE : I cant create a Windows Authentication to the client.
So, I create a login Called    Satish with Password
Satish@123  ,
when client login with Satish , and if he selects a  Select SUser_sname()  he will get a
Satish as Output , but my requirement is i have to display a
client name(System Name).
Very Urgent , Please do me need full.

You may refer here:
CREATE LOGIN login1 WITH PASSWORD = 'J345#$)thb';
CREATE LOGIN login2 WITH PASSWORD = 'Uor80$23b';
GO
CREATE USER user1 FOR LOGIN login1;
CREATE USER user2 FOR LOGIN login2;
GO
--Give IMPERSONATE permissions on user2 to user1
--so that user1 can successfully set the execution context to user2.
GRANT IMPERSONATE ON USER:: user2 TO user1;
GO
--Display current execution context.
SELECT SUSER_NAME(), USER_NAME();
-- Set the execution context to login1.
EXECUTE AS LOGIN = 'login1';
--Verify the execution context is now login1.
SELECT SUSER_NAME(), USER_NAME();
--Login1 sets the execution context to login2.
EXECUTE AS USER = 'user2';
--Display current execution context.
SELECT SUSER_NAME(), USER_NAME();
-- The execution context stack now has three principals: the originating caller, login1 and login2.
--The following REVERT statements will reset the execution context to the previous context.
REVERT;
--Display current execution context.
SELECT SUSER_NAME(), USER_NAME();
REVERT;
--Display current execution context.
SELECT SUSER_NAME(), USER_NAME();
--Remove temporary principals.
DROP LOGIN login1;
DROP LOGIN login2;
DROP USER user1;
DROP USER user2;
GO

Similar Messages

  • How to get the system name of the client?

    Hi,
    I 've followed this Blog:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/getting%252blogged%252bin%252bportal%252buser%252bdetails%252bin%252bweb%252bdynpro
    getSAPUser() method returns the logged in user name.
    Is it possible to get the System name of the client?
    Thanks,
    RPN

    Hi,
    Following Code returns the System id :
    String sid = System.getProperty("SAPSYSTEMNAME");
                                       if(sid.equals("J2E")){
                                            //Do something                                   }
    Siddharth

  • I have a problem with my white macbook, this message keeps popping up when I start the laptop " no matching processes belonging to you were found " even though I didn't mess up with the system or even use terminal. It just appeared

    I have a problem with my white macbook, this message keeps popping up when I start the laptop " no matching processes belonging to you were found " even though I didn't mess up with the system or even use terminal. It just appeared without Doing anything!!
    And now I can't use the " tap an click " from my tack-board and no nothing was spilled on my mac.
    Please help  

    Check your login items in the Users & Groups preference pane. Remove any that you don't recognize.

  • Get the project name to use in a procedure?

    How to get the project name to use in a procedure?
    example <% = odiRef.getOption ("COMPATIBLE")%> - but the project name or your id?
    in ODI 11.
    thanks
    Edited by: user ODI Dev on 01/12/2010 16:42

    I also need solution for this issue.
    I want to set ODI variable value in Jython script, this method described there: How to assign value for a ODI variable from Jython Script
    I need to update snp_var_data table. For more flexible solution i need to know project name where variable declared, because variable name in snm_var_data consist of two part <PROJECT_NAME>.<VAR_NAME>. Also this name convention don't changed after import scenarios from dev to execution repository
    Edited by: 822130 on 19.12.2010 4:31

  • How can i get my system name / IP address in JAVA

    Hi i need to get the system name / IP address of the machine where the JAVA program is running. Please help me in this.

    Try this
    java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
    System.out.println(addr.getCanonicalHostName());
    System.out.println(addr.getHostName());
    System.out.println(addr.getHostAddress());Col

  • How can I get the App store to use money in my account rather than a credit card when I want to buy something?

    How can I get the App store to use money in my account rather than a credit card when I want to buy something?

    The iTunes/Mac App Stores use credit on an account first. You are asked to supply an additional payment method when the cash credit doesn't cover the complete cost of the purchase.

  • I updated my 4s to ios7 and the phone is now completly dead. I tried to restore it with the new itunes but it won't restore. If you can't get the download be glad! Anyone have any ideas other than going out and buying a new Samsung phone?

    I updated my 4s to ios7 and the phone is now completly dead. I tried to restore it with the new itunes but it won't restore. If you can't get the download be glad! Anyone have any ideas other than going out and buying a new Samsung phone? I don't really need a paper weight.

    No not jailbroken. After the update which took about 45 minutes. The phone went black. Dead. Wouldn't restart. Using the new itunes I tried to restore it. It went through the motions; the white Apple and progress bar appeared on the iphone screen. Then I got a message "Itunes has detected an iphone in recovery mode. You must restore this iphone before it can be used with itunes." Then the phone went completly dead again. I Repeated the process and got the same results. Is there another way to restore the phone if it's dead, besides itunes?

  • (261718088) Q: Can you use xm:multiple with Objects other than String?

    Q: Can you use xm:multiple with Objects other than Strings?
    <br>
    A: You bet. Attached find a text file with some code from the example I showed
    today, a version of the multipleSayHiTo() method that has a parameter of an Array
    of Person objects rather than a parameter of an Array of Strings. The code within
    the text file comes from the Greeting.jws file (the Greeting Web Service).
    [multiple.txt]

    So you are saying that the recovery discs I made do include the copy of windows that was originally installed?
    Absolutely! They will restore the hard disk to its original out-of-the-box contents. Follow the instructions in the section Restoring from recovery DVDs/media, which begins on p. 73 of the User's Guide.
       Satellite A660 Series User’s Guide
    maybe i can make a deal with wd to have them swap this drive out for the BEKT instead...
    That would be a good idea in any case.
    As I said, the 10-fc12-045d error would not be due to the drive's being AFT, but more likely the discs are not being read properly. New discs can be obtained from Toshiba. Scroll down to Get Recovery Media here
    -Jerry

  • How I get rid of the Firefox 'Be a web hero etc' & other like windows appearing? It's irritating!

    How I get rid of the Firefox 'Be a web hero etc' & other like windows on starting Firefox. It's very very irritating.

    You can add this code to userContent.css to hide the snippets container on the about:home page.
    * http://kb.mozillazine.org/userContent.css
    * http://kb.mozillazine.org/Editing_configuration
    You can use the ChromEdit Plus extension to have easier access to the customization files.
    * ChromEdit Plus: http://webdesigns.ms11.net/chromeditp.html
    <pre><nowiki>@-moz-document url(about:home){
    /* hide snippet container on the about:home page */
    #snippetContainer { display: none !important; }
    </nowiki></pre>

  • To Get current System Name / Machine Name

    Hi all,
    Is there any thing to get the current System Name or Machine Name In PL/SQL?
    Thanks in advance.
    Regards,
    GowriShankar.N

    Try :
    SELECT p.pid, p.spid, p.program, s.sid, s.program
    into lvpid, lvspid, lvprogram, lvsid, lvprogram2
    FROM v$process p, v$session s
    WHERE p.addr = s.paddr AND s.sid = (SELECT sys_context('userenv', 'sid') FROM dual);
    display :
    PID SPID PROGRAM SID PROGRAM
    25 12278 oracleBECD@v480d-01 145 SQL Developer
    1 rows selected

  • Getting file system name

    Is it possible to get a File's partition file system name .
    I mean like "FAT32" or "NTFS".
    thx
    R0mai

    Because I'm developing an installer for a linux live-cd and it's bootloader : (syslinux) is not working on FAT32 file system, and I want to warn the user that it will not work.
    If anybody can help to make syslinux work with FAT32, that would be also good for me.
    R0mai

  • Get Logical system name from Message type

    Hi
    I need to call Transaction  BD93 for which I need Logical system. I have created a Custom basic type for CLFMAS02.
    Now I need to find out in thhe program which logical system is configured for the custoem basic type say 'ZCLFMAS02'.
    Is ther any Function module or Logic to get Logical system details from Basic type.?

    Hi Gautam,
    Check with the tables EDP13 and EDP21, the outbound and inbound parameters tables respectively, where you can key-in the message type, basic type and get the corresponding logical systems.
    ~ Bineah

  • Renaming files with invalid characters in their names on NTFS partitions, introduced by operating systems other than Windows

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

  • System won't let me configure to anything other than stereo

    my pavilion dv7-7020us no longer allows me configure the sound as 4.1 or anything other than stereo. this problem started within the last couple of days tho i'm not sure exactly when as i mostly use headphones. i've reinstalled all of the system drivers and ofc the audio drivers and it made no difference. i'd rather like to get my sound working the way it's supposedta again.

    anybody else had this problem?

  • How do I get the RSS Feed to work when loading onto server other than .mac?

    Does anyone have any knowledge of this? I am uploading a site created in iWeb on to a Media Temple which of course, disables many key functions in iWeb. One thing it supposedly doesn't disable though, is the RSS Feed, provided you input the proper URL when publishing the site. However, after nearly 20 tries with as many variations on the url as I could think of, nothing seems to work. Anyone have any insight? Many thanks in advance.

    It takes two things...
    1. Entering the correct base URL in the Publish to Folder window, and...
    2. Uploading the correct files to your server
    Number 1
    When you select "Publish to Folder", there should be a little text field where you are asked to enter in a URL. What you need to enter here is the base URL for your site, and in most cases this is simply your domain name: http://www.yourdomain.com That's it. Nothing more. iWeb will then take this URL base and generate a functioning RSS feed URL.
    Number2
    When you select "Publish to Folder", you are asked to specify a folder INTO which iWeb will save the files necessary for the functioning of your site. You will need to upload only the CONTENTS of this specified folder, which includes only TWO items: an index.html file & your sitefolder. You must upload only these two items to your server WITHOUT the enclosing folder (the one you told iWeb to publish into.
    If you satisfy the above two conditions (and only if you satisfy these two conditions), then you will end up with a functioning, automatically generated RSS feed from iWeb on your own server. There are other ways of achieving this endpoint (a functioning RSS feed), but this is the ONLY way to get iWeb to do all the work for you.

Maybe you are looking for

  • How to Setup Flash Builder ActionScript only project for iPad?

    Hello! Can someone give a short guide on how to setup an ActionScript only prject in flash builder such that it can be compiled using adt and deployed to the iPad? i created successfully iphone games using FlashIDE and PFI. now I'd like to create an

  • HT4064 I want to comment on a book and I cannot submit it. Do I need to turn something on?

    I cannot comment on a book I read in IBooks, it will not let me submit? Do I need to turn something on?

  • Address Book List Output to File

    How can I output an Address Book printed contact list to a file (instead of to my printer) so that I can do further editing on the file in Pages? Alternatively, how can I input the PDF file into Pages which can be produced by the Address Book list pr

  • Idoc to idoc scenerio

    Hi ,          i have created new tecnical system (web as abap) for receiver R3 system. When i am sending idoc ,It shows error in XI system: Receiver service  cannot be converted into an ALE logical system please help

  • Opening xlsm files created in 2010, not supported in 2013

    When opening an Excel 2010 document ending in xlsm in Excel 2013, there are columns missing. Something is happening to the macros. I'm not sure what to do and I'm getting the run-around from Microsoft direct, nobody can help. I cannot believe that I'