Get Windows User Name In Trigger?
Apr 16, 2014
User is login to the application using SQL Server Authentication method. I want to get his windows OS username to log in one of my security trigger.
All of the following:
SUSER_NAME(), SYSTEM_USER AS OSUser, SUSER_SNAME() AS SuserSName, ORIGINAL_LOGIN() As OriginalLogin, USER_NAME() as UserName
Are returning database user name, while i need OS username.
View 1 Replies
ADVERTISEMENT
May 29, 2007
We are looking at developing an SQL Server 2005 Database and I would like to use Windows Authentication rather than SQL Server Authentication to connect our client app.
In our development environment, we have two Servers, one being used as a file server and the other as an SQL Server. We have now set up a domain using the file server as the domain controller. (We had previously been set up to use a workgroup).
I have set up an active directory group called SqlDevelopers and added an active directory user called Jonathan to it.
On the SQL Sever, in management studio, I have set up a new server login which uses windows authentication called DomainSqlDevelopers. I used the GUI to verify I could see the domain and the group.
The default database is set to a test database on the server. A user in the test database is mapped to the DomainSqlDevelopers and given the Roles dbo, db_datareader, db_datawriter.
To test the log in, on the server, I logged out as administrator and in as Jonathan. I could successfully access the server through management studio using windows authentication.
However, if I log in as Jonathan on my client PC and try to access the SQL Server using management studio and windows authentication, I have problems.
The first time I try I will get a timeout error. If I try again will get either:
Login failed for user ''. The user is not associated with a trusted SQL Server connection
Or
Cannot generate SSPI context
I can€™t determine any pattern to which of the above errors I get.
However, if I log in as administrator on my client PC, I can connect to the server using management studio and windows authentication.
Sounds like Active Directory/Domain or other Network issue (Not really my area). I would be grateful for any help.
Thanks,
Jon
View 9 Replies
View Related
Aug 2, 2006
I have a user who cannot login to a .mdb when he is logged
in to Windows, on his workstation or any other.
No one can login to the .mdb when he is logged in to Windows.
He CAN login to the same .mdb if someone else is logged in
to Windows, either on his workstation or any other.
When the user logs in he gets the following error:
MS SQL Server Login
Connection Failed:
SQL
State: €˜28000€™
SQL Server Error 18456
[Microsoft][ODBC SQL Server Driver][SQL Server] Login failed
for user €˜domainusername€™
I have removed and recreated the ODBC Connection
while he is logged in. I have tried changing the trusted login to
administrator (in the window that pops up when he fails to connect).
He has the permissions he needs to the .mdb because he can
login under anyone else€™s profile.
I tried copying his profile to a brand new user and ended up
with the same result.
This leads me to wonder if there is some corruption in one
of his profile€™s .dat files or ???
This is the boss€™ account and he does not want to be given a
new username and profile€¦
Microsoft SQL Server
2000 - 8.00.760 (Intel X86)
Running on MS Windows 2003 Server Standard SP1
All workstations are XP SP2 with MS Access 2003 SP2 (from
Office Pro distro)
We use roaming profiles.
All systems within the same physical and logical network and domain.
Any help you can provide will be greatly appreciated.
Please let me know if there is any additional information you need.
Thanks,
Mike
View 6 Replies
View Related
Jul 23, 2005
We were using sql authentication on our sql server 2000 servers, Butneed to use windows authentication. I have an sql user jdoe that ownsmany different objects in multiple databases. I have tried adding thewindows login of jdoe with the exact same permissions as the sql userjdoe, but it complains because it says jdoe already exists. So Iattempt to delete the sql user of jdoe (remembering the permissions soI can reapply them to the windows user soon to be created) But it says"you cannot drop the selected login id because that login id ownsobjects in one or more databases" So now I am trying to figure out howto change the ownership of those many many objects in the manydatabases from jdoe to dbo so I can delete this sql user of jdoe. Doesanyone know of a way to convert an sql login to a windows login? Or ifthat can't be done, how to change the owner of many objects to dbo so Ican delete this user? Maybe a T-SQL script or stored procedure. Thereis a stored procedure called sp_changeobjectowner but that only worksfor one object, how would I do that on all the objects that jdoe owns?As you can see I am a newbie but I appreciate any help you canprovide!!! Thanks in advance!
View 3 Replies
View Related
Jun 20, 2008
When attempting SQL Replication I am getting an error that the user I setup for connecting to the Distribution database was unable to connect. I have setup a domain administrator user on our Domain (Active Directory) with the name of SDP. In order to test the SDP login I attempted to connect as DOMAINSDP, and it failed. If I login to Windows (2000) as SDP I can connect to the Server using Windows Authentication without any problem.
Why can I not connect using SQL Server Authentication as DOMAINSDP when I am logged into Windows as kblum? Is there some sort of setting that I need to establish to allow this?
TIA
View 1 Replies
View Related
Jan 2, 2008
How can i add a windows user to sql server to access specific database with read and write permissions.
Thank you very much.
View 1 Replies
View Related
Jul 6, 2007
I've scoured Google searching for an answer that seems like it should beeasy but apparently isn't...when I open SSMS to connect to a SQL 2005database and choose Windows authentication, it greys out the User Namebox...problem is, the server I need to connect to is in another domain...howon earth are you supposed to specify a different Windows user name toconnect with other than the one currently logged into the machine?-Ben--Posted via a free Usenet account from http://www.teranews.com
View 1 Replies
View Related
Feb 1, 2007
Hi,
I have an c# windows service, which is running on the same machine where my mssql server is installed. This service must be informed for each insert/update/delete event on one specific table.
My idea was to create an CLR Trigger for this table which can communicate with this service via .NET remoting. But the problem is, that the system.runtime.remoting assembly is not integrated within the mssql clr enviroment => i can't use remoting.
Are there any other idea's how can i solve this?
Best regards,
Thomas
View 2 Replies
View Related
Jul 4, 2002
Hi,
How do we make a normal Windows NT user as DBO in Sql server 2000?
Thanx
View 2 Replies
View Related
Apr 9, 2015
I'm almost sure that it's not possible, but I wanted to ask in case that I'm missing something.Is it possible to get the Windows user when someone logins using SQL Server Authentication? I know how to get the hostname, but I can't find how to make the next step.By the way, do sleeping connections affect performance? Would they consume resources such as RAM or network?
View 1 Replies
View Related
Sep 24, 2015
Below is the scenario
I have 2 users.
User1 : have sql rights on database but dont have rights to login into windows
User2 ; have rights to login into system but dont have access rights to database
Now I have windows application and i have logged into system with User2 and want to run windows application with the rights of User1. How can i achieve this.
View 5 Replies
View Related
Jun 21, 2007
Hi,
Is it possible to create a new user into Windows 2003 users table (not Sql) through a sql 2005 query ?
I ask this because I forgot the admin password of the Windows 2003 server and this is in a remote location, so I though, since I have the admin password of SQL 2005 server, maybe it could help me to log onto Windows 2003 and reset windows admin password.
Any help would be eternally appreciated
Regards.
George
View 4 Replies
View Related
Jan 6, 2007
Hi all,
Could somebody please help me out? I'm running Windows 2000 on my laptop. I opened a new user account and gave it administrative privilegies. I copied the administrative profile to the new account and everything seemed to work except when I tried to open any office application a dialogue appeared prompting me to place the Windows 2000 office CD rom in the drive. Why has this happened? How can rectify this problem since I don't have the CD rom.
Thanks in advance for any help.
View 1 Replies
View Related
Dec 30, 2007
I have a website written in asp.net and the current DATABASE logins do not use windows authenticaton. They are for online use only with a username and password. I'm trying to run my program locally on my machine and access the database locally. This is very frustrating. I'm able to connect to my database, but I can't login to it. Here's my connection string from ym webconfig file:
<add name="sqlConnectionString" providerName="System.Data.SqlClient" connectionString="Connect Timeout=8; Initial Catalog=linkexchanger; Data Source=SCOTSQLEXPRESS; "/>
I have the MSSQL engine running and I have connected with the SERVER. My database is in my directory tree of Microsoft SQL Management Studio Express. The server is SCOTSQLEXPRESSI have attempted to add a login to my sql database by right clicking on the security folder to create a new login. My understanding is that under windows, I don't need a uid and pwd in my connection string . Thus I tried removing all of this just as you see above, and I get an error message every single time I try to create a login with windows authentication.
Can someone please explain how I make this work?
Thank you.
Scot
View 1 Replies
View Related
Jun 18, 2007
Hi
In our sql server we have around 40 windows group.
Say a Windows user = "X"
This X user does not have a direct windows login, he is present in one or more windows groups registered in the sql server.
I need to know throught which group he is logging in.
If I know this , this will help in my auditing process.
Thanks in advance.
Regards
Soorya
View 1 Replies
View Related
Jun 7, 2015
I am setting up security for access of database tables for members in a specific Windows User Group.I want to check in a SQL script if this Windows User group is added and if so, add database users and grant SELECT on specific tables.
I have tried this:
SELECT * FROM master.sys.syslogins WHERE name like '%FoeUsers' AND isntgroup = '1'
but that selects a SQL user or group and not a Windows Group.Is there a way to check if a Windows NT (active Directory) user group exists?
View 5 Replies
View Related
Jun 17, 2007
I was able to do this on a Windows XP machine but I am not able to get this to work on a Windows 2003 Server machine.
I am connecting to the Windows 2003 Server and MS SQL Express via remote desktop on the lan.
This is what worked for me before:
EXEC sp_grantlogin '4800X2ASPNET'
USE MyDB
EXEC sp_grantdbaccess '4800X2ASPNET'
EXEC sp_addrolemember 'db_owner', '4800X2ASPNET'
But for some reason now I am getting this error:
Msg 15401, Level 11, State 1, Procedure sp_grantlogin, Line 49
Windows NT user or group '4800X2ASPNET' not found. Check the name again.
Msg 15401, Level 16, State 1, Line 1
Windows NT user or group '4800X2ASPNET' not found. Check the name again.
Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75
User or role '4800X2ASPNET' does not exist in this database.
I thought what I needed to add was the name of this pc that will connect remotely, but that doesn't seem to be working.
What weird is the old copy of this query I used had the local pc as the computer name. If I exchange the computer name from the remote pc name to the local 2003 Server machine name, the query works fine. Although that still doesn't let me add connections via Web Developer Express without error. It doesn't make sense to me anyhows, how could I have used the local machine's name and not the remote machine's name to get this to work previously. So confused.
Thank you in advance for help.
View 1 Replies
View Related
Mar 4, 2008
We have SQL 2000 Enterprise edition. There are several outside joins to MS Access tables.
I need to find out what would be the best way for me to locate a Windows authenicated users permissions on a table with the SQL database. I cannot seem to find any way to trace this information.
Thank you in advance
View 3 Replies
View Related
Oct 26, 2006
I have some script which creates/grant priveleges to windows/nt users to DB but i frequently get the message below:
Windows NT user or group '<user or group>' not found. Check the name again.
I understand that this is because the said user/group is indeed not present in the environment I'm running the script (ie. testing and production environment).
But is it possible to have some sort of checking whether the user/group exists in the environment so that I could determine whether or not to call some lines of code?
Not sure if this is possible so i had to ask. c",)
View 7 Replies
View Related
Feb 22, 2008
I wrote a simple SSIS package that runs a batch and a stored proc. They both run fine. I can see the stored procedure run and in process under task manager I see the batch run. However I don't want the batch to run under the System account, how can I change to another user. Thank you.
View 4 Replies
View Related
Mar 27, 2006
Hello
how can i get current logged windows user name in tsql. I know with windows aut it is possible how can i get this when sql auth.
Is there any system function or any special codeing required ?
regards
Chikuu
View 8 Replies
View Related
Aug 17, 2007
Is there a form of ALTER USER or other option that would allow me to change the Windows-based login associated with a user account?
According to BOL, I cannot use the sp_change_users_login trick since I want to rewire up to a Windows login, not a SQL Server login.
-- Margo
View 1 Replies
View Related
Jun 28, 2007
Is there a way to connect to database using Windows authentication as a different user than what you've logged in with to your desktop?
For example:
I log on to my desktop as mydomainme. I'm developing queries using Management Studio against a database (on another server) where mydomainme doesn't have access, but the admins have granted access to mydomainJobs1. I have the password for mydomainJobs1, and I'm hoping I can connect to the database using that account without having to log-off my local desktop as mydomainme and then re-login using mydomainJobs1.
The analogy in the file/share-permissions world would be using "net use" from a command prompt:
net use \SomeServer /User:mydomainJobs1 jobs1password
Anything similar for SSMS?
View 1 Replies
View Related
May 2, 2007
Good morning,
I'm in the process of creating a report to show employees and managers holiday and absence information. Is there a way of filtering the results of the report based on who is running the report, so that employees could only see their own information and managers could only see theirs and their subordinates information?
What I was hoping to do was create a lookup table which cross-references Windows logins with employee numbers and then use this information to pass a parameter to the SQL query, but I don't know how to retrieve the login from the machine being used to view the report.
I've heard about row level security and it seems ideal in theory but I fear the implimentation of row level security would be far beyond my meagre knowledge.
Any constructive suggestions welcomed.
Thanks,
Paul
View 3 Replies
View Related
Aug 1, 2006
Hello Everyone,
I am trying to connect SQL database through code but I get this error,I have spent days to solve it but unfortunately I couldn't...Here is my code in VB express(OP:windows 2000 with SP4)I am new to VB,so it makes the situation more difficult for me.
my code is:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn1 As SqlConnection = _
New SqlConnection("Data Source=.SQLEXPRESS;" & _
"Integrated Security=SSPI;" & _
"database=deneme3_database;")
'Open connection
conn1.Open()
MessageBox.Show("Connection succeeded.")
'Close connection
conn1.Close()
MessageBox.Show("Connection closed.")
End Sub
The error message is,it is in german but it is clear I guess:)
" Die von der Anmeldung angeforderte "deneme3_database"-Datenbank kann nicht geöffnet werden. Fehler bei der Anmeldung.
Fehler bei der Anmeldung für den Benutzer 'ADPLANatalay'. "
Thank you in advance!
Can
View 6 Replies
View Related
Jul 19, 2007
If I have a domain user DOMAINuser1 who belongs to multiple window groups say DOMAINLookupConfigUsers and DOMAINAuditConfigUsers. In sqlserver, I would create two logins - DOMAINLookupConfigUsers and DOMAINAuditConfigUsers and matching users in the database. Then I grant LookupConfig role to the LookupConfigUsers user and AuditConfig role to the AuditConfigUsers user in the database. When DOMAINuser1 logs in, will it have both roles? I try to set this up but it does not seem to work. The domain user only picks up one of the role. Am I on the right track? If not, what is the proper way to grant multiple roles to a user when it belongs to multiple groups and each group has different privileges in the database.
View 4 Replies
View Related
Jan 3, 2000
I have a trigger that emails me each time an order is modified by a manager. I can't recall how to find out which user is performing the modification. Is there a global variable such as @@username?
Thanks,
-Darin.
View 2 Replies
View Related
Jun 17, 2007
I was able to do this on a Windows XP machine but I am not able to get this to work on a Windows 2003 Server machine.I am connecting to the Windows 2003 Server and MS SQL Express via remote desktop on the lan.This is what worked for me before:EXEC sp_grantlogin '4800X2ASPNET'USE MyDBEXEC sp_grantdbaccess '4800X2ASPNET'EXEC sp_addrolemember 'db_owner', '4800X2ASPNET'But for some reason now I am getting this error:Msg 15401, Level 11, State 1, Procedure sp_grantlogin, Line 49Windows NT user or group '4800X2ASPNET' not found. Check the name again.Msg 15401, Level 16, State 1, Line 1Windows NT user or group '4800X2ASPNET' not found. Check the name again.Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75User or role '4800X2ASPNET' does not exist in this database.I thought what I needed to add was the name of this pc that will connect remotely, but that doesn't seem to be working.What
weird is the old copy of this query I used had the local pc as the
computer name. If I exchange the computer name from the remote pc name
to the local 2003 Server machine name, the query works fine. Although
that still doesn't let me add connections via Web Developer Express
without error. It doesn't make sense to me anyhows, how could I have
used the local machine's name and not the remote machine's name to get
this to work previously. So confused.Thank you in advance for help.
View 1 Replies
View Related
Feb 6, 2006
I'm working on an ASP.NET project, and we're attempting to switch from SQL Server authentication to Windows authentication to connect to the database.
It works fine locally when I debug in Visual Studio, but when it hits the web server, I get the error: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
IIS has anonymous access disabled, and Integrated Windows Authentication is checked. The web.config file has:
<authentication mode="Windows"/><identity impersonate="true"/>
The database I'm attempting to access is on a different machine than IIS, and the connection string doesn't contain a username or password, and has "Trusted_Connection=Yes", and "Integrated Security=SSPI".
From what I've been able to find online, I'm guessing the problem is due to IIS and SQL Server residing on different machines, but I'm not sure how to fix it.
Any ideas?
View 3 Replies
View Related
Feb 26, 2006
I have installed visual studio 2005 with sql express. My tutorial book asked me to do the following to be able to use sql.
sqlcmd -S mycomputernameSQLExpress -E
which worked and then I get
1>
where I am to put in
1> sp_grantlogin [mycomputernamemyusername]
2> go
after this i get the error.
Msg 15401, Level 11, State 1, Server mycomputernameSQLEXPRESS, Procedure sp_grantlogin, Line 49
Windows NT user or group 'mycomputernamemyusername' not found. Check the name again.
I used Local System for the user name as that is what I think I am seeing as the right user account.
Help?
View 4 Replies
View Related
Apr 22, 2006
Good Day,
I have an application that is being developed on Visual Studio 2005 (VB) and SQL Express. The application is set up to use the SQL Express on the development computer, and if an Internet or CD install is built, it installs SQL Express as expected. The question is, when it is time to deploy and put the SQL Express database on the 2003 server, how should the install on the server be done and how should we set the database path to the server?
Thanks,
Dave
View 1 Replies
View Related
Aug 11, 2015
My company has a Windows 2008 R2 server which is running SQL Server v11.0.5058. Â This server was previously running SQL Server 2008 and was recently upgraded. Â Since the upgrade I have noticed that when I connect to this server using SSMS and Windows authentication it seems as though I have a limited user context as I cannot see SQL Agent in the server tree at all and underneath the server security > logins folder I can only see the sa and SQL Server Windows service accounts (there are many more).
If I connect to the server using SSMS and the sa credential then I can see everything I expect to be able to see as a sysadmin.
I tried connecting as sa, then deleting my Windows AD account from the security > logins folder and reading my Windows AD account with the sysadmin role however this yielded the same result, when I connect using Windows authentication I still appear to be in a limited user context.
We have several other SQL 2008 / 2012 servers within our organization and all of them appear to be working fine / none of them exhibit this problem.
View 8 Replies
View Related
May 15, 2008
This may be an idiotic question:
I am attempting to use Visual Web Developer Express with a connection to a SQL Express db from a non-admin account on my XP Pro SP2 machine.
I can do everything in the app under an admin login, but can't seem to configure the db to allow the non-admin account access to the db. I've tried tweaking WMI, using Network Service, Local Service, and Local System with NT AUTHORITY, individual logins, and group permissions, but I'm stuck.
Any thoughts?
View 5 Replies
View Related