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  | 
                             
                            
                                    | 
                                         EMMERSON 
                                        Starting Member 
                                         
                                        
                                        3 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2013-03-07 : 06:24:58
                                            
  | 
                                             
                                            
                                            | Hi Im relatively new to SQL.How could i replace one character within a field but leave the rest how they are.ExampleI have a field which consists of x followed by 5 numbersx12345x23456x55555.I need to replace the x with a capital XThanks | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     MIK_2008 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    1054 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-03-07 : 06:35:38
                                          
  | 
                                         
                                        
                                          | SELECT Replace(ColumnName,'x','X') FROM YourTableName;CheersMIK  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     rjhe22 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    283 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-03-07 : 06:36:40
                                          
  | 
                                         
                                        
                                          | could do an update on the field with the new dataupdate table1set col1 = X12345where col1 = x12345something like that  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     visakh16 
                                    Very Important crosS Applying yaK Herder 
                                     
                                    
                                    52326 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-03-07 : 06:45:47
                                          
  | 
                                         
                                        
                                          First suggestion will work so far as you've format consistent in your field. if you happen to have other x characters inside they'll also get replaced.so better approach might be below if your format is not consistent.update table1set col1='X' + STUFF(col1,1,1,'')WHERE col1 LIKE 'x%' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     EMMERSON 
                                    Starting Member 
                                     
                                    
                                    3 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-03-07 : 07:12:16
                                          
  | 
                                         
                                        
                                          | Thanks that should do the trick  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     visakh16 
                                    Very Important crosS Applying yaK Herder 
                                     
                                    
                                    52326 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-03-07 : 08:43:41
                                          
  | 
                                         
                                        
                                          | welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |