Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 If SQL Statement in access
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

45 Posts

Posted - 05/15/2014 :  11:49:12  Show Profile  Reply with Quote
So I'm new to SQL and I was asked to populate a table so I did and some of the columns where missing information and was told to write an "If Statement that would say if column A is null then use columns of second table". Any advice would be appreciated.

Thank you.

Almighty SQL Goddess

38200 Posts

Posted - 05/15/2014 :  12:32:43  Show Profile  Visit tkizer's Homepage  Reply with Quote
I can only help with SQL Server, but are you wanting an UPDATE to fix the data or an INSERT to fix the import? Where is the source data?

INSERT INTO t1 (c1, c2, c3, c4)
SELECT T2.c1, T2.c2, T2.c3, CASE WHEN T2.c4 IS NOT NULL THEN T2.c4 ELSE T3.c4 END
JOIN T3 ON T2.c1 = T3.c1

Tara Kizer
SQL Server MVP since 2007
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000