Derived column expression

  • hello.....
    I am trying to achieve a column  named ISsytem  where i am trying to find the query as expression something like below
    Select case  when  model  like  '%Mac %' then 0 else 1 end as Issytem

  • Read this: https://docs.microsoft.com/en-us/sql/relational-databases/tables/specify-computed-columns-in-a-table

    And it should look like this:

    ISsystem AS CASE WHEN model LIKE '%Mac %' THEN 0 ELSE 1 END

  • +x

    komal145 - Thursday, July 6, 2017 1:24 PM

    hello.....
    I am trying to achieve a column  named ISsytem  where i am trying to find the query as expression something like below
    Select case  when  model  like  '%Mac %' then 0 else 1 end as Issytem

    As I suggested in another, related, thread of yours, use FINDSTRING.

    Case expressions in SSIS have the form
    Conditional Boolean Test ? [true part] : [false part]
    eg: 

    [Amount] < 300 ? "Low" : "High"

    Armed with these bits of info, you should be able to craft your expression.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Lynn Pettis - Thursday, July 6, 2017 1:30 PM

    Read this: https://docs.microsoft.com/en-us/sql/relational-databases/tables/specify-computed-columns-in-a-table

    And it should look like this:

    ISsystem AS CASE WHEN model LIKE '%Mac %' THEN 0 ELSE 1 END

    My question was to get the "SSIS expression" from the provided tsql query mentioned above.

  • Phil Parkin - Thursday, July 6, 2017 1:33 PM

    +x

    komal145 - Thursday, July 6, 2017 1:24 PM

    hello.....
    I am trying to achieve a column  named ISsytem  where i am trying to find the query as expression something like below
    Select case  when  model  like  '%Mac %' then 0 else 1 end as Issytem

    As I suggested in another, related, thread of yours, use FINDSTRING.

    Case expressions in SSIS have the form
    Conditional Boolean Test ? [true part] : [false part]
    eg: 

    [Amount] < 300 ? "Low" : "High"

    Armed with these bits of info, you should be able to craft your expression.

    Thanks for the suggestion in another post for findstring , i was able to create a script component to find the strings. For this i am trying to do derived column for another purpose so got struck with syntax.

  • komal145 - Thursday, July 6, 2017 1:36 PM

    Phil Parkin - Thursday, July 6, 2017 1:33 PM

    +x

    komal145 - Thursday, July 6, 2017 1:24 PM

    hello.....
    I am trying to achieve a column  named ISsytem  where i am trying to find the query as expression something like below
    Select case  when  model  like  '%Mac %' then 0 else 1 end as Issytem

    As I suggested in another, related, thread of yours, use FINDSTRING.

    Case expressions in SSIS have the form
    Conditional Boolean Test ? [true part] : [false part]
    eg: 

    [Amount] < 300 ? "Low" : "High"

    Armed with these bits of info, you should be able to craft your expression.

    Thanks for the suggestion in another post for findstring , i was able to create a script component to find the strings. For this i am trying to do derived column for another purpose so got struck with syntax.

    OK, the syntax I used above works in derived columns, so you should be all set.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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