Date Range in SSIS

  • Good morning everyone;

    I am trying to setup my first SSIS package with a date range and for some reason I keep getting errors. If someone already talked about this then I do Apologize. Here is what I am trying to do:

    I am trying to set up a start date and an end date for the report so this report can run monthly on the first business day after the 5th of the month.

  • I am not getting what you are trying to do. Could you please be more specific so that others would also understand better and many will reply to your question and get you going.

    Basically, what are you trying to so? Getting some data and passing it somewhere? Is that why you are using SSIS?

    [font="Verdana"]Imagination is more important than knowledge-Albert Einstein[/font]

  • wpotter (2/27/2008)


    I am trying to set up a start date and an end date for the report so this report can run monthly on the first business day after the 5th of the month.

    Hi,

    Could you provide more information, tables involved, data type, what are you plannig to do with the data?

    Would be glad to help you out.

    [font="TimesNewRoman"] “I haven't failed, I've found 10,000 ways that don't work”........Thomas Alva Edison[/font]

  • hello,

    from within a Execute SQL Task, I want to read two date values and give it to the output, because I wanted to use as parameters or variables in a data flow task.

    Output are 2 variables with namespace user :

    1. dtMCStartDate

    2. dtMCEndDate

    in the data flow taks, I've mapped this to :

    Param0 = dtMCStartDate

    Param1 = dtMCEndDate

    problem is, that I can't see, what is the sql, what is really performed ? The ? in the following SQL should be two dates

    example :

    SELECT *

    FROM AccountInfo

    WHERE timeStampCreate between ?

    and ? and direction = 'I'

    order by InMSGID

    Running the task, I get nothing in the dataviewer, but I know, that there should be some data in the data table.

    thank you for answering

  • The parameters are mapped right to me...

    1) What you could do is execute the same sql query in Sql Server... See if you get any results from that..

    2) Avoid using Select * Instead specifically name the individual fields you need obtain..

    3) Usea result set so that the Query Results would be stored in a variable or somewhere...

    Hope these help...

  • thank you,

    but what I'm looking for ist :

    In the sql pane, you write

    select a,b,c from table A

    where A.date1 between ? and ?

    Now, it would be nice, in debugging mode to see sonmething like that :

    - sqlcommand.text before parameter replacement:

    select a,b,c from table A

    where A.date1 between ? and ?

    - sqlcommand after parameter replacement

    select a,b,c from table A

    where A.date1 between dtStartdate and dtEndDate

    - sqlcommand after parameter replacement with values

    select a,b,c from table A

    where A.date1 between convert(datetime '1.2.2008',104) and convert(datetime,'2.22008',104)

    You see what I want to say ?

    By the way, I've found the reason, why I haven't no success :

    this parameters came from a migration job, so I've mapped

    1. dtMCStartdate and

    2. user:dtMC$startdate

    this is not the same, so I've no result

    regards

    manfred

  • go through the link [highlight=#ffff11][/highlight]if it doesnt make u clear let me know .......

    http://www.sqlis.com/58.aspx

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • I have run into a problem that your piece touches on. I would like to put the value of a date range into a variable. Specifically select daterange from tablea where daterange is varchar. The value of datrange should be something like 'June 3 thru June 5,2008' (as an example it would vary in actual practice). I would like it to be placed in variable User:DateRange which I believe should be defined as script and is known to the task. I have tried running it as a SQL Task and it fails with a type mismatch even though I can manually copy the value located in tablea and paste it into the variable without error in the variable 'window'). What am I missing?

    thanks in advance

  • Is your variable type specified correctly?

  • well the type is string which should be adequate (there was a typo)

  • But your datatype on the database is date and/or time?

    Why not make your variable the same and give it a try

  • it has to be char or varchar since it contains a date range in the following format 'June 2 thru June 3,2008'

  • Now you have me confused.

    You want to use that range in a SQL statement?

    Why not have a datefrom and dateto variable (date)

    Then you can specify where date >= datefrom and date <= dateto

    ~PD

  • Actually I suppose that that could be done although in the end the value of daterange will need to be passed to a file name. In fact it is a part of a conversion project of long running DTS package that pulls data from a database and creates an excel spreadsheet with the value of daterange in the filename and placed in the body of an email. In fact for this re-development process the value of daterange in a table to be accessed via select daterange from table and then placed in a user::variable to be placed in a filename later.

  • So on your table you have daterange as a field?

    Or how is the data structured on your table

Viewing 15 posts - 1 through 14 (of 14 total)

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