Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2008
    Posts
    56

    Unanswered: sqlcmd not working

    Hi,
    I am running into an issue with sqlcmd in sql 2005. We are running it from the client machine via a z drive map to our application sever. On a client that has a sql client installed it runs fine. On a client that doesn't have a sql client we get an error of :
    The system cannot execute the specified program

    We don't want to have to install the sql client on all the user machines. Is there a workaround? Can we place the unknown missing files on our application server (z drive). How can I determine what is missing?

    Here is how we run it
    Z:\>sqlcmd -U UserName -P Password -S 192.168.4.4 -d primarydb1 -Q "EXEC usp_runProc


    Thanks

    Rebecca

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The error that you posted is a Windows permission problem. The sqlcmd.exe program hasn't gotten started yet.

    The client machines will need to have the SQL Native Client installed in order for sqlcmd.exe to run, and I suspect that other supporting DLLs are needed too but I'm not certain of that.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Oct 2008
    Posts
    56
    Thanks,
    Do you think it would work if I placed the sql client on the app server? Then when it runs from the Z drive the files shoud be present.

  4. #4
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Try Full path before sqlcmd ?

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Unless the user logged into the client PC has explicit Read and Execute permissions on at least the sqlcmd.exe file, Windows won't try to run the file. It doesn't matter where the file sits if they don't have the necessary permission either explicitly or inherited.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  6. #6
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by Pat Phelan
    Unless the user logged into the client PC has explicit Read and Execute permissions on at least the sqlcmd.exe file, Windows won't try to run the file. It doesn't matter where the file sits if they don't have the necessary permission either explicitly or inherited.

    -PatP

    Yeah, definitely, registry settings, paths, env vars, etc.

  7. #7
    Join Date
    Jun 2009
    Posts
    26
    Hi Rebecca,
    I don't think running it from a share will work unless you have the client installed locally (regardless of permissions).
    I think Pat's right - you will be missing the libraries (dlls) that sqlcmd.exe depends upon unless you install the client locally. I just monitored the files sqlcmd.exe accessed on my local computer and there was at least one dll from the SQL install that was used.

  8. #8
    Join Date
    Oct 2008
    Posts
    56
    Thanks,
    We had something similar working on SQL 2000 with isql and placed the DLLs in the same folder. I thought this would be similar but perhaps not.

    Wilvis,
    How do you monitor what files sqlcmd has accessed?

    Thanks for your help.

  9. #9
    Join Date
    Jun 2009
    Posts
    26
    Moving the dll's to that folder may still work but you'll have to test it...

    On XP / 2003 you can monitor the files sqlcmd.exe uses by running a program called filemon (FileMon for Windows)

    I'm using 64 bit vista which didn't get along with filemon to well... I used the resource monitor. To access resource monitor open Task Manager -->Performance tab --> Click on resource monitor button. Then click on Disk to see details of which files are being access by which process.

  10. #10
    Join Date
    Oct 2008
    Posts
    56
    Thanks Wilvis,
    Looking at what sqlcmd needs through filemon now. There are over 40 dlls and still counting. I know it works when I load the sql client on the local machine. I might have to go this route.

  11. #11
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I would VERY STRONGLY recommend installing the SQL Client on any machine where you want to use SQLCMD. You might possibly finagle things to the point where you could run sqlcmd without doing the install, but it would be an ugly mess to support.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  12. #12
    Join Date
    Oct 2008
    Posts
    56
    Pat,
    I think you are right. So far I have found over 40 dlls that are running when sqlcmd is invoked. Not sure which ones I would need to copy over to the directory where sqlcmd resides.
    It seems to be much easier to install the client.
    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •