How Can A User Change Password In SQL2005 Via TSQL?
Mar 30, 2007
I have an application that controls user logins, passwords, etc. at the front end for a SQL database. I am in the stage of migrating to SQL2005 and cannot get the TSQL code to allow a user to change their own password. Here's the background;
The ADMIN of the app is a Sysadmin on the SQL server and can create logins, set roles, etc. Assume the Admin creates a user TOM with a password of xxxx. This works fine using the create login statement from a Connect.Execute statement from my app like so;
"Create Login 'TOM' With Password 'xxxx', Default_Database = 'myDB', Check_Policy = OFF"
TOM will be setup with db roles as well
When TOM logins into my app, he will have to change his password at some point. The TSQL code I am using (which fails) is executed by TOM who has a connection to the SQL db because he is logged into the app.
"Alter Login TOM With Password = 'xxxx' Old_Password = 'xxxxx', Check_Policy = OFF"
At this point I get an error:
RunTime error -2147217900 (80040e14)
ODBC SQL Server Driver][SQL Server] Cannot alter
the login 'TOM', becuase it does not exist or you do
not have permission.
Obviously it exists since TOM is currently logged into the SQL Server. So if it's permissions related, what permissions does a user need to change his/her password? Or is there another way to do it?
Thanks in advance for your help.
CH
View 7 Replies
ADVERTISEMENT
Dec 20, 2007
I'm having trouble running TSQL commands when SQL2005 is in single-user mode.I've restarted SQL with -m, -c, -T3608 set in the startup options.I can get into Config manager OK, but as soon as I try to start a NewQuery it complains that the DB is in single-user mode and there'salready someone connected to the DB.Is there something I need to turn off? If not, how am I supposed torun queries in single-user mode? What I want to do is move the modeland msdb databases but I can't run the commands to do this until I getpast this problem.Thanks for any assistance you can give on this.Mike
View 6 Replies
View Related
Sep 30, 2006
Hello
I newly installed SQL Server 2005 .I did not mention any username and password during installation.But now i want to specify one.Can you tell me how to do so .My Operating System is WindowsXp.
Thanks In Advance
Poornima
View 2 Replies
View Related
May 23, 2008
HI,
I m swagatika and working on a s/w company.I am facing some problem in MS SqlServer2005.
my problem is:-
i installed sql server2005 completely .At the install time , i set the username='xyz' and password=blank (windows authentication mode).
Now i want to change my user account to 'sa' and password to blank.
After installation,how to change the user account and password.
Please can anybody help me ?
View 3 Replies
View Related
Jan 13, 2006
SQL Server 2005 Express will not allow me to change the password for my login user. I tried deleting the user and re-creating the user. Another password is being put in although the password I put in was accepted. I even test to see what would happen if I left the password blank. It got accepted. But when I look at the password for my login user again, a different and much longer password was put in. I even tried this T-SQL statement:
CREATE LOGIN <loginname> WITH PASSWORD='<passwordname>', CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF
I am out of ideals. Is this a bug?
View 5 Replies
View Related
Jan 13, 2006
SQL Server 2005 Express keeps putting in a different password than the one I chose. I would check the properties on the login I want to change. Then I change the password and it gets accepted. When I try my web application, I get the dreaded "login failed for <loginname>". I look at the properties again and see my password never change. Is this a bug? I ever tried this syntax to no avail:
CREATE LOGIN <loginname> WITH PASSWORD='<mypassword>' CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF
View 3 Replies
View Related
Jul 22, 2015
We need to use SQL Server Authentication for some reason and would like to enforce Password Policy with 90-day expiration period. I found "Change password" dialogue appears when I first logged in with the new user, but don't know
(1)what happens when the user failed to change the password before it's expired or
(2)how a user can change his password in advance of the expiration date with no particular server-level permission.
View 10 Replies
View Related
Nov 21, 2007
I would like the Backup SQL user A can backup and restore DATABASE_a, what access right I need to grant to him. Although he can backup the database_a to the c:Program Files.....Database_a.BAK but he cannot restore it with some message said ''not enough security privieges..
Please quote some example right assigment so that I can replicate to our environment
Many Thanks...
View 6 Replies
View Related
Jul 12, 2010
My goal is to write a DR plan where i am restoring all user databases onto a diffrent server in a event of hardware failure. I was trying to figure out a way to extract DDL of user accounts and their permissions on all user databases so i can simplify my DR documentation.
This is the plan I came up with...to restore all system and user dbs on a different Physical SQLServer.
1. build named instance $PROD
2. restore master database
- startup sqlserver in single user mode -m or DAC sqlcmd -S ServerName -U sa -P<xxx> –A
net stop MSSQLSERVER$PROD
net start MSSQLSERVER$PROD -m
- restore database master from disk e:master.bak with replace;
3. start sqlserver normally
4. stop SQLServer agent
5. restore msdb
-restore database msdb disk e:msdb.bak with replace;
6. restart SQLServer
7. Restore User Databases.
8. Run Sp_change_users_login for all users
-Sp_Change_users_logins 'auto_fix','username'
View 7 Replies
View Related
Dec 16, 2004
We have a little app to help us move applications from developent --> stage --> production. It uploads the files, runs the new stored procedures etc.
One of the things it does is create new columns in existing tables. In EM you can create a new column in any position, but ALTER TABLE seems to only add columns to the end of the table. Is there a way in TSQL to create columns in arbitrary positions in the table? Or do I have to recreate the whole table?
View 2 Replies
View Related
Jun 26, 2007
Once the SQL2005 cluster is installed can I change the "physical" server name of the 2 server nodes in the cluster. I do not want to change the virtual server name but the "physical" Windows server name....
Steve Dunn
sdunn@esiindy.com
View 1 Replies
View Related
Apr 20, 2001
I have one server out of 6 that lets me logon as SA with the default password
of null.
If I run this command to change the password I get password changed, but it
did not change it, I still can logon as SA with the NULL password.
exec sp_password NULL, abc123, 'sa'
View 2 Replies
View Related
May 4, 2000
The old administrator left and I am learning slowly. Since his password was changed, SQL cannot start. I get an error 1069 login failed. Maybe you have a good idead I haven't thought of?
View 1 Replies
View Related
May 7, 2001
I changed the sa password now all my jobs fail, if
I change the password back to what it was they run.
Any insight is appreciated.
Thanx
View 2 Replies
View Related
Sep 20, 2005
I've searched this forum and was surprised to not find this asked before - Is there any way to change SA's password (we have managed to lose it somehow)? And we do have physical access to our SQL Server of course...if that helps.
thanks in advance,
jamie
View 4 Replies
View Related
Jul 17, 2006
We have change administrator password. How can i change the sql server job password, so that the maintain plan work fine as before. Thanks.
View 4 Replies
View Related
Aug 28, 2006
Dear experts,
i'm getting problem with sql server 2000. actually i changed the service from automatic to manual, right from that day,sql server is not working on my machine.when i checkd in the properties of sql server registration, it is showing some around 8 letter password. actually i will connect with sa and password sa.
where should i change the password? is there any other solution?
or is it better to uninstall and install again? if so what about my databases?
please help me in this regard
View 12 Replies
View Related
Jan 11, 2007
ikram writes "i have to changed the password of sql server and after password change it is not assassable form the network. some of my friend tell me that you will have to change some configuration form server side file. he dont know that file exactly. please tell me the soloution.
regard."
View 1 Replies
View Related
Dec 17, 2007
Hi All,
I am newbie at SQL server, we have sql 7.0, sql2000 and sql2005. we need to change SA password but developers claim they have hardcode the SA password.
anyone can tell me where developers hardcode this SA password? what are the files i need to look up? if they hardcode it, impossible to change?
any ideas and thoughts are welcome.
Thanks in advance
Regards
Nonie
View 3 Replies
View Related
Jan 9, 2008
Any way to change the password on QA without knowing the old password?
http://www.sqlserverstudy.com
View 6 Replies
View Related
Apr 15, 2008
I have a SQL JOB that I inherited that uses FTP to xmit some data. When I attempt to change the password within the FTP job a window warns me that files will be deleted. My question is are these files just sytem buffers or will any important files get the axe ? Thx in advance. Lou
View 4 Replies
View Related
Sep 8, 2007
I have a SQL database hosted on a server. This server supports SQL Sever 2000. How do I change the password to the password?Thanks in advance,
View 1 Replies
View Related
Apr 4, 2008
I am trying to change password, using the code below.. The code below is in a stored proc and I am passing these parameters from a web application.....
sp_password [ [ @old = ] 'old_password' , ] { [ @new =] 'new_password' } [ , [ @loginame = ] 'login' ]
sp_password 'cust1','cust2','cust1'
Server: Msg 15210, Level 16, State 1, Procedure sp_password, Line 20Only members of the sysadmin role can use the loginame option. The password was not changed.
I made my user part of the db_securityadmin role, but that does not help...
How can I give the above mentioned permissions, so that when user cust1 logs on then he can chnage his own password from the web application as long he has given his old password correctly?
View 3 Replies
View Related
Apr 3, 2001
When using osql from a command prompt the following script was run:
EXEC sp_password 'Current Password', '', 'TestLogin'
We were trying to set a password for a login to blank, but now cannot access login into the application because the application was looking a blank password for this user but the password would not work for blank.
Note ---This client only has MSDE installed, not SQL Enterprise.
If the script is run from Query Analyzer it works fine.
The script should have been this:
EXEC sp_password 'Current Password', Null, 'TestLogin'
It should have explictly stated NULL for the new password but it wasn't done.
Is there anyway to reset the password without knowing the existing password.
No other logins exist. They tried logging into the system with no password, '',"".
I am not sure what the password was set to.
View 3 Replies
View Related
May 24, 2001
Howdy - I am using SQL 7.0. I have done some research using the Books On Line and I do not find any documentation on how to change the sa password using a SQL Script. Can anyone point me in the right direction?
View 1 Replies
View Related
May 27, 2004
I just installed MS SQL SERVER2000, but seems the password I was setting didn't look good. So I want to change it, but how? Thanks!
View 2 Replies
View Related
Sep 30, 2006
Hello
I newly installed the SQL Server 2005.During installation i chose the option Mixed Mode.I aslo did nit mention any user name and password to the SQL Server.Iam able successfully create Databases using the SQL Server Management Studio.
My problem iam unable to connec to the SQL Server from my .net windows application.My application code is
Dim strCon As String
Dim sValue As String
Dim strQuery As String
Dim dsEventTransac As New DataSet
Dim daEventTransac As New SqlClient.SqlDataAdapter
Dim rowCount As New Integer
Dim oWebService As New WebReference.TkmService
'Dim nwRow As DataRow
'Dim delCmd As SqlClient.SqlCommand
strQuery = "SELECT * FROM EventTransaction"
strCon = "Data Source=localhost;integrated security=SSPI;initial catalog=KmsDb;User ID=sa;password="
objCon = New SqlClient.SqlConnection(strCon)
If objCon.State = ConnectionState.Closed Then
objCon.Open()
End If
daEventTransac = New SqlClient.SqlDataAdapter(strQuery, objCon)
Dim cmdBuilder As New SqlClient.SqlCommandBuilder(daEventTransac)
daEventTransac.Fill(dsEventTransac)
'update the DataAdapter
daEventTransac.Update(dsEventTransac)
oWebService.Url = "http://192.168.0.10/TkmService1/TkmService.asmx"
''display the table in a grid
dgEventTransac.DataSource = dsEventTransac.Tables(0)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles dgEventTransac.Navigate
End Sub
End Class
When i donot specify user ID and password i get connected correctly.But when i run the above code i get an error
"Unable to connect to the remote server"
Now i want to change the username and password.Please tell me how to do
View 2 Replies
View Related
Feb 21, 2008
Theres a script that the SQL workprogram instructs someone to run which shows the last change date for a users password.
Within the results of the script theres two rows of dates and I would like to know which date indicates the "last password change date"
View 2 Replies
View Related
Mar 11, 2008
Hi All,
we plan to change SA password and there are 2 servers running on replication.
what are the precautions that i have to consider?
what is the fallback plan should changing SA password causing other error/ bugs?
can somebody tell me the exact steps to change SA password for this kind of environment?
thanks in advance.
-Nonie
Nonie
View 6 Replies
View Related
Jan 25, 2008
We have an application using SQLDMO tried to change password. From the trace file, it seems the application used a "SP_password" and the operation failed. However, the application returns its own message which doesn't help us at all in finding the reason. I wonder if SQL server can somehow track the operation(password change) and report a message if it failed.
Does anybody know if SQL server 2005 have such type of functionality? Or what could be the possible reasons of the operation failed. (The new passowrd fullfill the requirement of window policy.)
Thanks
View 4 Replies
View Related
Apr 28, 2015
We are wanting to change the SA password on one of our Sql server 2012. My question is what are the implications? Will our agent jobs still run? SSIS packages still run under agent jobs? Is there a proper way/how to change SA password?
View 3 Replies
View Related
May 16, 2008
Hello everyone,
In SQL Query I need to update a field to my ASP.NET app which has a variable User.Identity.Name() where it contains the Form Authentication of current logon user, SQL has the suser_name() function but this is not what I needed because it returns the user accessing the Database.
UPDATE [tblData] SET [UserUpdated] = User.Identity.Name() <= this failed because SQL doesn't recordnize the User.Identity.Name() function. Is there any method I can use to achieve this?
Thanks in advance.
View 2 Replies
View Related
Jun 19, 2007
Hi,
I was wondering if it is possible to change the password on a SQL Server 2000 DTS package programatically instead of justmanually using the the interface?
I have over 150 DTS packages used for building BI data cubes and our password policy requires a password change every 60 days.
I would like to write a windows vb.net application that loops through all the DTS packages and changes the password.
Please advise.
Thanks
Chris
View 2 Replies
View Related