Finding Date

  • I have created DTS package to perform a Bulk Insert. The problem is that every month the Source Text file changes its location according to Month.

    How would I change the source location according to the present Month? My directory structure has been labeled, January, February Etc.........

    exec @result = master..xp_cmdshell 'dir "April\data.txt"'

  • monthname(date) will give you the current month as an activeX item. If you need SQL, then select datename( m, getdate()).

    If this is SQL 2000, you can use a dynamic properties task to change the properties of the bulk insert task.

    Steve Jones

    steve@dkranch.net

  • I like your Dynamic Property task Idea and yes this is SQL 2000. The only thing is Im not sure on how to do what your saying. Any help as to how to implement this?

  • Create a global variable in your dts package.

    then a stored procedure, something like:

    ----------

    declare @month varchar(50)

    set @month=DATENAME(m,getdate())

    exec master..xp_cmdshell 'dtsrun /S srvname /E /N yourPackage /A yourvarname:8="C:/" & @month & "/data.txt"'

    ---

    Edited by - EugeneZh on 04/25/2002 08:38:14 AM

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

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