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 |  
                                    | daytymerStarting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2014-01-10 : 09:37:44 
 |  
                                            | I have a customer who needs to update records in a table. The table has a field 'response_Code. If a pan in the table is also in a text file then response_Code needs to be set to '41' if the response_Code is anything other than '41'. The text file will contain between 60000-100000 records.Can a script be written to look at the text file and then do a compare of the table?Thanks,Joe Teicheira |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2014-01-10 : 09:43:50 
 |  
                                          | yep..using OPENROWSETthe logic would be like UPDATE tSET response_Code = '41'FROM Table tINNER JOIN OPENROWSET('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=<your directory path>;','SELECT * FROM <filename.txt>')fON f.columnname = t.panAlso seehttp://www.sqlusa.com/bestpractices2008/import-csv/------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |  
                                          |  |  |  
                                    | daytymerStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2014-01-10 : 12:37:11 
 |  
                                          | Visakh,Thank you for the quick response. I think this will do what I want.Joe Teicheira |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2014-01-10 : 23:14:44 
 |  
                                          | welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |  
                                          |  |  |  
                                |  |  |  |