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.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • 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.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

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

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