Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         swapna.anu 
                                        Starting Member 
                                         
                                        
                                        3 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2011-09-30 : 09:22:20
                                            
  | 
                                             
                                            
                                            | HiCan any one tell me how to write a query to get data from a table when joined with another table comparing all the columns data which has data containing varchar, int, datetime, bit, tinyint etc.For eg:Table ACol1   Col2   Col3   Col41        ABC    Test    01/09/20112        XYZ     Test1   02/09/20113        PQR    Test2    10/09/2011 Table BCol1   Col2    Col3   Clo41        AAA     Test    02/08/20112        XYZ     Test1   02/09/2011  4        BBB     Test5   01/10/2011Expected Results as belowCol1   Col2    Col3   Col41        ABC    Test    01/09/20113        PQR    Test2  10/09/2011I need to compare all the columns in both the tables and return1. if something different in both the tables2. if something missing in Table B which is in A but don't need the records if missing in A but available in BPlease let me know how to make this work. I am not looking only for joins but any query which will make this task easy and will be able to use inside SP.Thanks in advance. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     swapna.anu 
                                    Starting Member 
                                     
                                    
                                    3 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-09-30 : 10:30:51
                                          
  | 
                                         
                                        
                                          | Got this working using the below querySELECT S1.* FROM (SELECT checksum(*) AS CheckSumVal, * FROM Table1) s1 LEFT JOIN (SELECT checksum(*) AS CheckSumVal FROM Table2) s2 ON s1.checksumVal = s2.checksumval WHERE s2.checksumval is nullThanks.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |