I'm having a problem running a sql script when my SQL Express 2005 database has a complex password. I'm trying to run a stored procedure that exists in the database. Here's the SQL script I'm runniing:
EXEC dbo.spInsertNewDatabaseInitialValues
I return the result to a variable. If the database has the sa password set to pass, the variable shows SUCCESS. But if I change the sa password to @qmispass1 (and change the password in the IA script), the variable shows ERROR.
Any thoughts ?
TIA,
Steve.
SQL script and complex passwords
The @ mark is used for variables.. you have to put the password between quotes ( ' ) so sql will treat them as a string and not as variable..
eg '@mypass' and not @mypass..
eg '@mypass' and not @mypass..
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
-
- Posts: 14
- Joined: Thu Mar 09, 2006 4:14 pm
A related issue. I need to change the existing SQL Server Express sa password from 'pass'. I've tried calling the stored procedure sp_password from my SQL script with the proper parameters, but even though it returns SUCCESS, the password doesn't change. Here's the SQL script to change the password:
EXEC master.dbo.sp_password @old = 'pass', @new = 'foo', @loginame ='sa'
Go
When I run it from within an OSQL prompt it runs fine. I thought perhaps the @ was causing a problem in the SQL script, so I even tried assigning that line to a variable and referencing my variable in the SQL script. Same thing - it returns SUCCESS but doesn't actually change the password.
Any thoughts as to what I'm doing wrong?
EXEC master.dbo.sp_password @old = 'pass', @new = 'foo', @loginame ='sa'
Go
When I run it from within an OSQL prompt it runs fine. I thought perhaps the @ was causing a problem in the SQL script, so I even tried assigning that line to a variable and referencing my variable in the SQL script. Same thing - it returns SUCCESS but doesn't actually change the password.
Any thoughts as to what I'm doing wrong?
You propably don't have permissions to do it when you connect to it through your script..
Check the roles of the user you are connecting to the database..
If it runs from the osql tool, it should run from anywhere..
Check the roles of the user you are connecting to the database..
If it runs from the osql tool, it should run from anywhere..
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
-
- Posts: 14
- Joined: Thu Mar 09, 2006 4:14 pm
I'm not too sure it's a permissions issue. In the script I set the user to sa - same as I do in OSQL. However, I'm going to consider the issue moot. Fortunately, there's always more than one way to accomplish a given task. I created a small executable that changes the password, and I call that from within my script.
Thanks for the help!
Steve.
Thanks for the help!
Steve.
-
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
Would taking EXEC out of the first line help - could you try that real quick?
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
It's the same Michael.. Either putting EXEC in front or not, it's absolutely the same..SQL Server executes the sp no matter what! 

Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation
Who is online
Users browsing this forum: No registered users and 202 guests