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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Run Database executable from sql script

Author  Topic 

dzirkelb
Yak Posting Veteran

53 Posts

Posted - 2008-11-24 : 12:31:47
I am trying to run the following in an sql query anyalyzer, or in a stored procedure (same result):

EXEC master.dbo.xp_cmdshell 'c:\PackSlip-EInvoice.mdb'

What happens is the database will lock itself, msaccess.exe is running on the server, but the database itseld does not run its macro. The macro is the following:

setwarnings off
outputto filename
setwarnings on
quit

I am thinking this is hanging up because the output to filename has the possibility of having a pop-up for the user (if the file exists, it will ask to overwrite it). However, the filename will never need to be overwritten (we have a process that deletes the file).

Any ideas on what I can do to make this work? I know running an access database from a stored procedure works as I have others that simply print reports, but this one hangs up.

If anyone can think of a better solution, then I am open to them. Here is what i wish to do:

I wish to output to a .doc file (same name everytime), automatically, while running an sql stored procedure.

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2008-11-24 : 23:40:42
I'd recommend you write some code in a programming or scripting language (like Windows Powershell http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx), running that kind of process in a SQL Server xp_cmdshell is not really a recommended solution.
Go to Top of Page

dzirkelb
Yak Posting Veteran

53 Posts

Posted - 2008-11-25 : 08:53:11
I briefly read about that, and it appears I am either confused as to what it does, or will not work. I need this to work from the web, aka, run a page, it prints a document with bar codes. I need it to run from access as the bar fonts only will scan from access.

Currently, I can run a page and have the report be printed (I dump the invoice number and type of pack slip into a temp table, then print based off that information). however, when I try to output it to a document, it hangs up. Is there anyway to do like an auto save automatically overwriting the current file that is there? I wish to output a report automatically and auto save it with the same name every time, and auto overwrite what is currently there if there is a file there. Is there some coding in access that I could do accomplish this?
Go to Top of Page

dzirkelb
Yak Posting Veteran

53 Posts

Posted - 2008-11-25 : 16:22:46
I found the problem. The problem is the linked tables in access. The report links numerous other small access tables, and fails when they are linked.

I found this by rebuilding the query table by table, and it failed everytime i added a ms access linked table to another access linked table. If I imported that table into sql and then re-built the query again, then it worked ok.

Any ideas? or, any ideas on where I should look?
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2008-11-25 : 21:52:55
So if you want to do this with Access and a web page then I still don't understand why you're trying to use SQL Server to run an Access macro in a command shell. Use ASP or ASP.NET code in the web page to load up the Access database and run whatever you need to in there.
Go to Top of Page

dzirkelb
Yak Posting Veteran

53 Posts

Posted - 2008-11-26 : 08:55:02
I have to open up a lot of permissions if I run it from the web, which I don't really want to do.

Also, I have to upgrade our version of access and do not want to do it on the web server (as access 97 and bar codes do not work correctly together).

I can try the upgrade, and that might be ok, as the linked tables would not be across the network then, they would be specific to that server itself.
Go to Top of Page

bobbell
Starting Member

1 Post

Posted - 2015-03-05 : 22:30:29
I am currently having a report created in SQL Server 2008 where we are generating the Barcode as custom report item, when I tried the same I found that this is not supported in SQL server 2012 reporting services.

Kindly suggest how can I add a Barcode as a custom report item in SQL server 2012 reporting services

Thanks in advance.
Go to Top of Page
   

- Advertisement -