Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Help needed Expand / Collapse
Author
Message
Posted Wednesday, November 14, 2012 8:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 28, 2013 4:25 PM
Points: 2, Visits: 9
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]



Post #1384957
Posted Wednesday, November 14, 2012 10:17 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 6:04 AM
Points: 1,127, Visits: 1,599
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
Post #1384975
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse