If ExISTS

  • How can write t-SQL code t oaccomplish

    if a file exists in some folder then passing that file name as a parameter to run a DTS task.

  • Why does it have to be T-SQL ?

    Use the right tool for the job. If you already have a DTS package, then use an ActiveX script task in the package and either VBScript or the FileSystemObject to determine if file exists.

  • you could use xp_fileexist extended stored procedure, search this web site and you should see how to use it.

  • xp_fileexist, I did nto find this SP.

     

    What am trying to do is ..

    End user will be passing a file name to load to a SP where the file name is a parameter for the SP. How can I select the file name given by the user and also raise an error if the file psecified is not found.

  • I think you are taiking the incorrect path. Load the file to a folder , shcedule your DTS to run every 1 hour or so, your dts shuld look if there is a file in the folder then copy the file to a generic file name like this copy *.csv to importdsta.csv make your DTS packed to import always from importdsta.csv process the file. To avoid executions errors from the DTS packages you may copy and empty file with the file that you are going to process or include a action VB script to check for the file in the workflow property/ options/ activex script.

    hope this help.

    Pedro R. Lopez
    http://madurosfritos.blogspot.com/[/url]

  • jp...

    It looks like you already have the DTS task which will run if the file is found.

    Why don't you just set up an ActiveX script task with a File System Object to look for the file at the beginning of your DTS package execution.  Schedule the DTS package to run every x minutes or x hours (whatever interval you need).  If the file is found, you can get the filename right then and there using the File System Object and execute the rest of the DTS package.  If the file is not found then don't execute the rest of the DTS package.

     

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

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