473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Problem with script

We've got a couple of scripts that we routinely run on several SQL
servers, and they usually run fine. But we're trying to run them on one
particular server, and we're running into problems. I'm no expert with
SQL, but two DBA's who I work with have spent hours on this and they're
stumped, so I don't feel so stupid. Maybe someone here can help.

Basically, we've got a .bat file that calls a .sql file. Within the
..bat file, isql is called a couple of times with no problems. Within
the .sql file, there are several lines like:

exec master..xp_cmdshell @@cmd

@@cmd has previously been defined as a text string that begins with
isql.

Whenever this runs, we get the error:

'isql' is not recognized as an internal or external command,
operable program or batch file.

In other words, it can't find the file isql.exe.

We already made sure that the Windows PATH variable for the user
running the .bat file includes the folder that has isql.exe in it.
Someone said that they once had a problem where that folder had to be
the first folder in the PATH variable in order to recognize isql, so we
even made that change (and logged off and back in, then checked the
path from a DOS prompt to make sure the change took effect).

Anyone know anything else to check that would explain why our sql
script would be unable to find the isql.exe command? Any help would be
greatly appreciated.

--Richard

Jul 23 '05 #1
6 3788
Ok, I've got another detail that I was just looking at that seems like
it might be relevant. The initial .bat file uses isql to run the .sql
file. So maybe that has something to do with why the .sql file (run
from within isql) can't access isql? As I said, this works on most
other servers, so it's got to be some sort of security or something.

Would it the .sql file run from within isql use the same user security
as the .bat file that ran it? Or does it have seperate user access?

--Richard

Jul 23 '05 #2
bl*********@yahoo.com (bl*********@yahoo.com) writes:
Whenever this runs, we get the error:

'isql' is not recognized as an internal or external command,
operable program or batch file.

In other words, it can't find the file isql.exe.

We already made sure that the Windows PATH variable for the user
running the .bat file includes the folder that has isql.exe in it.


That's does count here. What counts is how the PATH for the user
under which SQL Server itself looks like.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3


Erland Sommarskog wrote:
bl*********@yahoo.com (bl*********@yahoo.com) writes:
Whenever this runs, we get the error:

'isql' is not recognized as an internal or external command,
operable program or batch file.

In other words, it can't find the file isql.exe.

We already made sure that the Windows PATH variable for the user
running the .bat file includes the folder that has isql.exe in it.


That's does count here. What counts is how the PATH for the user
under which SQL Server itself looks like.


That's the part I'm having trouble figuring out, I think. What user's
PATH would it be using when calling isql from within a .sql script that
was run by isql within a .bat file that was kicked off by a user?
Apparently, it's not using the PATH of the user who ran the .bat file.
I just don't know what user's PATH is being used.

As a temporary solution, I copied isql.exe to C:\Windows\System32,
since I know that'll be in the PATH of all users, and that worked.

--Richard

Jul 23 '05 #4
bl*********@yahoo.com (bl*********@yahoo.com) writes:
That's the part I'm having trouble figuring out, I think. What user's
PATH would it be using when calling isql from within a .sql script that
was run by isql within a .bat file that was kicked off by a user?
Apparently, it's not using the PATH of the user who ran the .bat file.
I just don't know what user's PATH is being used.


Just like any other Windows process, SQL Server logs into to Windows
with a user and a password. Ot it logs in as LocalSystem.

To find out how SQL Server, do this on the server machine: In Control
Panel find Administrative Tools. Go there, and find the Services applet.
Open Services, and find the SQL Server service. Double-click it to see
Properties. Log On information is on the second tab.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #5


Erland Sommarskog wrote:
bl*********@yahoo.com (bl*********@yahoo.com) writes:
That's the part I'm having trouble figuring out, I think. What user's
PATH would it be using when calling isql from within a .sql script that
was run by isql within a .bat file that was kicked off by a user?
Apparently, it's not using the PATH of the user who ran the .bat file.
I just don't know what user's PATH is being used.


Just like any other Windows process, SQL Server logs into to Windows
with a user and a password. Ot it logs in as LocalSystem.

To find out how SQL Server, do this on the server machine: In Control
Panel find Administrative Tools. Go there, and find the Services applet.
Open Services, and find the SQL Server service. Double-click it to see
Properties. Log On information is on the second tab.


Because I know that the .bat file has the security access of the person
who started it, I thought the sql script run by the bat file would, as
well. But apparently, it always has the security access of the SQL
service, which I didn't realize, but it makes perfect sense. Thanks for
the clarification.

I checked, and the SQL service does log on as LocalSystem. So now for
the next obvious question: Since LocalSystem isn't a real user, how do
I change its PATH variable to include the folder that contains isql.exe
and other necessary SQL commands? I've hunted around a little, and I
haven't been able to find anything on changing the settings of
LocalSystem. I only know how to change the PATH of the username that
I'm logged in as.

--Richard

Jul 23 '05 #6
bl*********@yahoo.com (bl*********@yahoo.com) writes:
I checked, and the SQL service does log on as LocalSystem. So now for
the next obvious question: Since LocalSystem isn't a real user, how do
I change its PATH variable to include the folder that contains isql.exe
and other necessary SQL commands? I've hunted around a little, and I
haven't been able to find anything on changing the settings of
LocalSystem. I only know how to change the PATH of the username that
I'm logged in as.


How to change the path for LocalSystem sounds like a question for
a Windows newsgroup. :-)

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ralph Sluiters | last post by:
Hi, i've got a small problem with my python-script. It is a cgi-script, which is called regulary (e.g. every 5 minutes) and returns a xml-data-structure. This script calls a very slow function,...
4
by: Federico Bari | last post by:
Good morning all from italy, i have probably a compatibility problem with a html/javascript page. The aim of the code of the file test.htm you find here following (copy the 3 files in the...
1
by: Kevin Potter | last post by:
We have an application that has been running on IIS4 and IIS5 for quite some time, without problem We're now migrating to IIS6 (windows/2003), and have run into a what might? be a Javascipt...
13
by: nobody | last post by:
Hello all, I've searched just about everything and although I can see that other people are having problems, but theirs don't seem to relate, so in a last ditch attempt, my posting! Script...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
9
by: Jerim79 | last post by:
Here it is: <?php if($_SERVER=='POST'){ $Number=$_POST; $Email=$_POST; $Number2=0; $error=0;
1
by: tehweb | last post by:
Background: I have a fixed position div on the bottom om my page. I have then added a dialog-div into this fixed position one. When I bring up the dialog, everything works if the the scrollTop is...
4
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.