Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2007-01-29 : 18:30:53
|
Hello all,I have a windows .bat batch file which has number of sql statements written to execute as displayed below:osql -S %1 -d %2 -U %3 -P %4 -i 1.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 2.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 3.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 4.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 5.sql -necho. Now, on the command prompt I give all these parameters and it worked fine for three-four times of testing. Yesterday, I ran this batch file again on my one of the test database, and it gave me error on 4.sql file for Login failed for user 'sa'. And that file didn't ran on server. However, it did successful logon while executing 5.sql.Any idea, why this happened? I checked Application Log on server, and it only said the same error message without any explanation.Thanks,Ujjaval |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-01-29 : 18:42:06
|
| Just use -E switch instead of -P and -U so that you don't need to put in userids and passwords.You got the error message because the password was incorrect at that moment in time. So perhaps someone accidentally switched the password on you then switched it back.Tara Kizer |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2007-01-29 : 20:39:20
|
| Hey Tara,I don't think that would be case. Because, its on my development machine and I am the only one who is using this username and password. Would there be any other case?Ujjaval |
 |
|
|
evjo
Starting Member
20 Posts |
Posted - 2007-01-30 : 04:52:44
|
| If you change the order what happens?eg. osql -S %1 -d %2 -U %3 -P %4 -i 5.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 4.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 3.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 2.sql -necho.osql -S %1 -d %2 -U %3 -P %4 -i 1.sql -necho.Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant, and she fell on me. Then it wouldn't seem quite so funny. - Jack Handey |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2007-01-30 : 18:18:40
|
| I can't really change the order. Because execution of the queries depends on the previous execution outcome.Ujjaval |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-01-30 : 18:41:03
|
| At the time that you received the error, the password was incorrect.Tara Kizer |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2007-01-30 : 18:51:33
|
| Hi Tara,I figured that would be the case. But, I am giving username and password on command prompt only once which are passing through all these commands in that batch file. So, technically, the username and password has not been altered in anyway. Plus, I'm the only one who knows this username and password. And no one else has modified as this username and password still works. So, I am trying to figure out why its like that.. I guess what should work, should just work. But its not the case here.. isn't it? :(Ujjaval |
 |
|
|
|
|
|
|
|