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 |  
                                    | rwsjbsStarting Member
 
 
                                        17 Posts | 
                                            
                                            |  Posted - 2010-03-22 : 16:16:28 
 |  
                                            | Thanks you for looking at my post.I am trying to compare two tables using the LIKE command.  Here are my variables:ProductNumber that starts with 12345xxxxxxThe Vendor.AccountNumber is 12345The first 4 to 6 characters in the ProductNumber always start with the Vendor.AccountNumber characters.I have tried the following script (doesn't work):where %ProductNumber LIKE Vendor.AccountNumber%Could you please tell me how to cinsert the % in the LIKE command to compare the two columns?Thank you,Richard Scott |  |  
                                    | vijayisonlyMaster Smack Fu Yak Hacker
 
 
                                    1836 Posts | 
                                        
                                          |  Posted - 2010-03-22 : 16:30:55 
 |  
                                          | [code]where ProductNumber LIKE RTRIM(Vendor.AccountNumber) + '%'[/code] |  
                                          |  |  |  
                                    | rwsjbsStarting Member
 
 
                                    17 Posts | 
                                        
                                          |  Posted - 2010-03-22 : 16:37:35 
 |  
                                          | Thank you for the solution.  This saved me a lot of time.-Richard Scott |  
                                          |  |  |  
                                    | vijayisonlyMaster Smack Fu Yak Hacker
 
 
                                    1836 Posts | 
                                        
                                          |  Posted - 2010-03-22 : 16:40:59 
 |  
                                          | Np. You're welcome. |  
                                          |  |  |  
                                |  |  |  |