Help needed

  • Hi Gurus,

    I am new to SQL server world. I need your valuable suggestion and help to have an approach for the below scenario.

    Details on tables and requirement attached herwith. I am also trying from my end to rectify the query.

    My requirement-:

    IF coulmn ICP is present in [R33HypInfa].[dbo].[DF012_Look_up_hfm] table then check for the columns Custom1,Custom2,Custom3. if any of these three columns have valid data then populate them else populate none.

    to check for the valid data we need to compare [R33HypInfa].[dbo].[DF012_HFM_Staging] table to [R33HypInfa].[dbo].[DF012_Look_up_hfm] and if custom1 of these two tables are not same then we need to further do a look up on [R33HypInfa].[dbo].[DF012_Look_up_hfm] for custom1 and [R33HypInfa].[dbo].[DF012_Look_up_hfm] for custom2 column.

    The column custom1 will be further looked up in a look up table called "[R33HypInfa].[dbo].[DF012_LKP_COMPARE_C1]" If present then valid in the staging table else invalid.

    The column custom2 will be further looked up in a look up table called "[R33HypInfa].[dbo].[DF012_LKP_COMPARE_C2]" If present then valid in the staging table else invalid.

    IF ICP is present then the value of ICP needs to be look up in [R33HypInfa].[[dbo].[DF012_C3_Class] table for custom3 column. then the value in custom3 will be populated in ICP column and custom3 will be none.

    [highlight=#ffff11]Attached below is excel sheet has table and all data information. [/highlight]

    Please help!!!!

    Tables-:

    1.[R33HypInfa].[dbo].[DF012_HFM_Staging]

    2.[R33HypInfa].[dbo].[DF012_Look_up_hfm]

    3. [R33HypInfa].[[dbo].[DF012_C3_Class]

    4.[R33HypInfa].[dbo].[DF012_LKP_COMPARE_C1]

    5.[R33HypInfa].[dbo].[DF012_LKP_COMPARE_C2]

  • Hi Abinash, Welcome to SSC.

    Its a good start, but this is not how you post a question in an online forum. Its near impossible to understand your requirement....just by reading your explanation. We can't see your problem from here until you post some readily consumable sample data. Attaching excel files is not considered readily consumable sample data. People here are working and take some time off their busy schedules to answer these questions, so nobody would have the time to download your excel files and then provide a solution.

    Please have a look at the link in my signature. It has all the information you need to get your problem solved quickly.

    Please post DDL of the tables, readily consumable sample data as a batch of Insert statements......an then post the requirement. If you do the above mentioned things then I am sure that someone would come up with a very quick....working....and tested solution to your requirement.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 2 posts - 1 through 1 (of 1 total)

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