Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Longmont, CO
    Posts
    258

    Unanswered: Run java script applet from stored procedure?

    Here's a good newbie question. Can I run a command-line applet from a stored procedure?

    I'm running a java script applet to convert .tif files to .pdf files and have a handy applet for such. The .tif files get dumped by a fax server into a particular directory. After conversion I need to move the new .pdf files to a different directory. For me this is a VB Script project for a DTS package that gets scheduled to run every x minutes.

    Is there a better way to do this from a sp? I keep hearing that you can do anything in a sp that you can do in a DTS package.

    Thanks for the help!

  2. #2
    Join Date
    Nov 2003
    Location
    Kirkland, WA, USA
    Posts
    5
    try using the system stored proc "xp_cmdshell," it takes the command as input and can return the results as well.

    Not sure what you are trying to do, but this may work!

  3. #3
    Join Date
    Jun 2003
    Location
    Longmont, CO
    Posts
    258

    Red face Close, but no cigar yet

    xp_cmdshell looks like it is just the ticket, however it isn't working for me--yet.

    Here's what I wrote (OK, I copied it from the Help files):

    ========================================

    CREATE PROCEDURE sp_FileConverter AS

    declare @result int

    exec @result = xp_cmdshell '%WINDIR%\SYSTEM32\cscript.exe C:\Program Files\Aquaforest\TIFF Junction\wsh\tiff2pdf.js C:\Access_Test\Fax'

    IF (@result = 0)
    PRINT 'Success'
    ELSE
    PRINT 'Failure'
    GO

    ==========================================

    When I try to run it I get "Could not find stored procedure 'xp_cmdshell'." Most annoying!

    What can I do to help SQL Server find it's own system sp?

    Thanks!

  4. #4
    Join Date
    Nov 2003
    Location
    Kirkland, WA, USA
    Posts
    5

    Re: Close, but no cigar yet

    try "master..xp_cmdshell"

  5. #5
    Join Date
    Jun 2003
    Location
    Longmont, CO
    Posts
    258

    Cool!

    Whohooo! That did it. At least SQL Server is happy with this now.

    Now, on to figuring out why my applet has stopped running! It's always something...

    Thanks for your help!

Posting Permissions

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