read excel file into different tables in the db

  • hi guys

    please help i have to create a package which reads data from excel file and insert into a database each excel file will have an ID but if ID is null or empty it should read into a different table.

    please assist

  • Use a Conditional Split transformation component in your data flow.

  • hi ..as micheal said u can do it throught conditional split ...

    from the excel source give it to conditional split once all transformations are done then in the expression give the condition so that it splits based on the condition u give ....

    Thanks,
    Chinna

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

  • hi guys thanks for help, i've added the condintional splits my only problem now what is the expression to check for null or empty values against in my ID field i've used SchemeID == "" and returns an error

  • Without seeing the error or the package, it is hard to tell.

    You probably have a data type issue though.

    If SchemeID is a string:

    ISNULL(SchemeID) || SchemeID==""

    Also - be sure to watch variable and column names. Some things in the expressions are case-sensitive.

  • the SchemeID fiels is and interger field

  • Then it cannot be an empty string, so you just want:

    ISNULL(SchemeID)

  • Without seeing the error or the package, it is hard to tell.

    You probably have a data type issue though.

    If SchemeID is a string:

    ISNULL(SchemeID) || SchemeID==""

    Also - be sure to watch variable and column names. Some things in the expressions are case-sensitive.

    hey micheal i have a Ques...i know expressions are case sensitive but what i dont understand is the expression u gave ...

    ISNULL(SchemeID) || SchemeID==""

    but in ISNULL you havent specified any replacement value ... i just even want to know why

    SchemeID=="" doesnt work ..could you please let me know that or explain me regd the expression above

    Thanks,
    Chinna

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

  • Like I said, the SchemeID=="" part needs to be removed because the variable is numeric and therefore cannot be empty string.

    As far as the expression:

    ISNULL(SchemeID) || SchemeID==""

    The ISNULL function is the expression ISNULL function, not the T-SQL function. Although they have the same name, they are not the same function. ISNULL in an expression takes a single parameter and returns a boolean. "||" is a logical OR.

  • Thanks Michael. I believe i should go through the Basics ....Bcoz i never know that isnull is diff from t-sql anyway i tried searching through google and got a clear idea.

    --------------------------------------------------------------------------------

    Important Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null, and therefore, False

    Thanks,
    Chinna

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

  • But in the expression we have =="" but null doesnt mean zero length string also ...so do we get the results we need according to his req because he needs to split the data from nulls

    IsNull returns True if expression is Null, that is, it contains no valid data; otherwise, IsNull returns False. If expression consists of more than one variable, Null in any constituent variable causes True to be returned for the entire expression.

    The Null value indicates that the variable contains no valid data. Null is not the same as Empty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.

    Thanks,
    Chinna

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

  • Ok, you are not paying attention. The column is a numeric data type, so the =="" part of the expression is not needed. In my post at 8:30 I indicated that all that is necessary is: ISNULL(ColumnName)

    As far as the "Empty" stuff - this is a column in a data flow - it has to be initialized. ISNULL will always work.

  • gotch u Micheal...thkz

    Thanks,
    Chinna

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

  • hi guys you were such a great help, my package works like charm

    thankx

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

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