FUNCTION

  • Can anyone explain to me how the following function works and what it is trying to acheive?Thanx!

    CREATE FUNCTION [dbo].[refiner] ()

    RETURNS varchar(255) AS

    BEGIN

    EXEC master..xp_cmdshell 'c:\pcplus\refiner.exe /auto=2'

    return "done"

    END

    If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!

    Edited by - achowe on 07/22/2003 03:08:55 AM


    If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!

  • Basically what the function does is running a programm refiner and the returns the output as a string value. If you wanna know more about Refiner check this site:

    http://www.afd.co.uk/pcpman/Refiner/

    [font="Verdana"]Markus Bohse[/font]

  • Actually it's not returning the output of Refiner. It's returning the string "done" in all cases, whether Refiner works ok, fails, or even not there at all.


    Cheers,
    - Mark

  • Thats what I thought.....we just cant seem to get refiner running using xp_cmdshell

    If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!


    If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!

  • Is refiner working ok using the same host command from a command prompt?

    When using the command prompt, are you logged on as the same Windows account as MSSQLServer?

    Should you save a Refiner session file and then utilise that session file with the /Session command line option?

    Do you need to also use the Minimise=Yes and /Splash=No command line options?

    Is this really a job for a SQL Server FUNCTION or are you better off with a PROCEDURE?

    At this stage I'd step back and try to get it running from QA before progressing to a stored procedure or function. To capture the results of xp_cmdshell (provided of course the refiner command runs to completion) I suggest:

     
    
    DROP TABLE #Refiner
    GO
    SET NOCOUNT ON
    CREATE TABLE #Refiner (ID INT IDENTITY PRIMARY KEY, Result VARCHAR(250))

    INSERT #Refiner EXEC master.dbo.xp_cmdshell 'c:\pcplus\refiner.exe /auto=2'

    SELECT Result FROM #Refiner WHERE Result IS NOT NULL ORDER BY ID


    Cheers,
    - Mark

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply