NewEra13 Posted February 16, 2015 Share Posted February 16, 2015 Hello, 1- We have some recors that exists in our "datamart" table but doesn't exists anymore in our source system tables. 2- Therefore, we want to hardcore "Unknown" or 0 values into some of those record's columns (column1 and column2 for example) 3- This is our 2 tables beeing involved: Datamart.TableA SourceSystem.TableB 4- We want to UPDATE our Datamart.TableA table as mentionned above in order to insert "Unknown" or 0 values on the columns of the recors that NO longer exists in our SourceSystem.TableB 5- This is how our 2 tables are linked: Datamart.TableA.Enumber = SourceSystem.TableB.Eid and Datamart.TableA.AccountNo = SourceSystem.TableB.AccountID QUESTION: I sort of have an idea that i will probably need to use a NOT EXISTS somewhere in my code as well as Datamart.TableA.Eunmber = SourceSystem.TableB.Eid and Datamart.TableA.AccountNo = SourceSystem.TableB.AccountID But, i'm not quite sure how to formulate all this. Any advice please ? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 16, 2015 Share Posted February 16, 2015 You can use not exists, or also not in. It would be a regular update query where you have not exists inside the where clause. Not exists would have a subquery that basically joins the two tables. Link to comment Share on other sites More sharing options...
NewEra13 Posted February 19, 2015 Author Share Posted February 19, 2015 Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now