Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #14330 > unrolled thread

Re: MS SQL Server: run external program

Started by"J.O. Aho" <user@example.net>
First post2021-07-29 14:26 +0200
Last post2021-07-30 05:05 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.databases.ms-access

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: MS SQL Server: run external program "J.O. Aho" <user@example.net> - 2021-07-29 14:26 +0200
    Re: MS SQL Server: run external program Erland Sommarskog <esquel@sommarskog.se> - 2021-07-30 10:24 +0200
      Re: MS SQL Server: run external program Ron Paii <ron81pai@gmail.com> - 2021-07-30 05:05 -0700

#14330 — Re: MS SQL Server: run external program

From"J.O. Aho" <user@example.net>
Date2021-07-29 14:26 +0200
SubjectRe: MS SQL Server: run external program
Message-ID<imfl3pFios7U1@mid.individual.net>
On 29/07/2021 12.43, Ammammata wrote:

Hi there,
this is a MySQL forum and has nothing to do with mssql or ms-access, so 
adding c.d.ms-sqlserver and c.d.ms-access which also been follow-up to.


> I'm trying to run MS Access runtime, with my procedure and an additional
> parameter
> 
> the command line is
> MSACCESS.EXE c:\Sviluppo\QCT\QCT1000.mdb ;255
> 
> without path, being it already included in the PATH variable

Maybe that is your account users PATH and not the system PATH. There is 
a creepy GUI that you can use and check that.


> when I try this command from within MSSMS
> 
> EXEC xp_cmdshell 'MSACCESS.EXE c:\Sviluppo\QCT\QCT1000.mdb ;255';
> GO
> 
> I get the error:
> 
> output
> 'MSACCESS.EXE' is not recognized as an internal or external command,
> operable program or batch file.
> NULL

You need to give the full path to the MSACCESS.EXE or see to that the 
service user that runs the mssql has the correct path set in PATH. Don't 
forget to restart the service after change in the environment variables.

> 
> If I include the path in the command line
> 
> EXEC xp_cmdshell '"C:\Program Files\Microsoft Office\Office16\MSACCESS.EXE"
> c:\Sviluppo\QCT\QCT1000.mdb ;255';
> GO
> 
> it goes into a loop and I have to kill MSSMS to exit
> 
> Note that I'm not sure how to use "" because of the space in the path
> between words Microsoft and Office

Looks ok, as microsoft made a bad choise to use \ as directory divider 
instead of /, so they couldn't escape characters as in most other 
operating systems with the backslash.


> Any suggestion is welcome

Switch to a proper OS and a better database

-- 

  //Aho

[toc] | [next] | [standalone]


#14334

FromErland Sommarskog <esquel@sommarskog.se>
Date2021-07-30 10:24 +0200
Message-ID<XnsAD7769DEE4408Yazorman@127.0.0.1>
In reply to#14330
J.O. Aho (user@example.net) writes:
> On 29/07/2021 12.43, Ammammata wrote:
> Hi there,
> this is a MySQL forum and has nothing to do with mssql or ms-access, so 
> adding c.d.ms-sqlserver and c.d.ms-access which also been follow-up to.
> 
> 
>> I'm trying to run MS Access runtime, with my procedure and an additional
>> parameter
>> 
>> the command line is
>> MSACCESS.EXE c:\Sviluppo\QCT\QCT1000.mdb ;255
>> 
>> without path, being it already included in the PATH variable

In *your* PATH variable. SQL Server runs under a service account, so 
it does not have your PATH.

>> If I include the path in the command line
>> 
>> EXEC xp_cmdshell '"C:\Program Files\Microsoft 
Office\Office16\MSACCESS.EXE"
>> c:\Sviluppo\QCT\QCT1000.mdb ;255';
>> GO
>> 
>> it goes into a loop and I have to kill MSSMS to exit
 
So when you run that command line directly, what happens? Specifically, 
does it open a UI?

SQL Server runs as a service and does not have a desktop, so running 
anything which has a UI is not going to work out.

[toc] | [prev] | [next] | [standalone]


#14335

FromRon Paii <ron81pai@gmail.com>
Date2021-07-30 05:05 -0700
Message-ID<1d927f68-f159-425f-b590-bcdf216ae352n@googlegroups.com>
In reply to#14334
On Friday, July 30, 2021 at 3:24:32 AM UTC-5, Erland Sommarskog wrote:
> J.O. Aho (us...@example.net) writes: 
> > On 29/07/2021 12.43, Ammammata wrote: 
> > Hi there, 
> > this is a MySQL forum and has nothing to do with mssql or ms-access, so 
> > adding c.d.ms-sqlserver and c.d.ms-access which also been follow-up to. 
> > 
> > 
> >> I'm trying to run MS Access runtime, with my procedure and an additional 
> >> parameter 
> >> 
> >> the command line is 
> >> MSACCESS.EXE c:\Sviluppo\QCT\QCT1000.mdb ;255 
> >> 
> >> without path, being it already included in the PATH variable
> In *your* PATH variable. SQL Server runs under a service account, so 
> it does not have your PATH.
> >> If I include the path in the command line 
> >> 
> >> EXEC xp_cmdshell '"C:\Program Files\Microsoft 
> Office\Office16\MSACCESS.EXE" 
> >> c:\Sviluppo\QCT\QCT1000.mdb ;255'; 
> >> GO 
> >> 
> >> it goes into a loop and I have to kill MSSMS to exit
> So when you run that command line directly, what happens? Specifically, 
> does it open a UI? 
> 
> SQL Server runs as a service and does not have a desktop, so running 
> anything which has a UI is not going to work out.

If you are using Access 2016 or newer with Office 2016 or newer you will need to account for click to run versions.

for 2016 click to run:
C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE

for 2016 normal
C:\Program Files (x86)\Microsoft Office\Office16\MSACCESS.EXE

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.ms-access


csiph-web