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  | 
                             
                            
                                    | 
                                         anupalavila 
                                        Yak Posting Veteran 
                                         
                                        
                                        56 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2009-02-11 : 05:34:39
                                            
  | 
                                             
                                            
                                            | Hi   I have a sql query like this which is used in an SP or generating reports select customerName,('PObox '+customerPOBox+' ,'+customerFaxNo)Contact from InventoryCustomerMastersome times customerPOBox field may be null on such data how can I avoid the label POboxThanks and Regards Anu Palavila | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     bklr 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    1693 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 05:47:53
                                          
  | 
                                         
                                        
                                          | select customerName, case when customerpobox is null then customerFaxNo else('PObox '+customerPOBox+' ,'+customerFaxNo) end as Contact from InventoryCustomerMaster  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     anupalavila 
                                    Yak Posting Veteran 
                                     
                                    
                                    56 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 06:15:05
                                          
  | 
                                         
                                        
                                          | thanks bklr for your valuable answerThanks and Regards Anu Palavila  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     bklr 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    1693 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 06:19:23
                                          
  | 
                                         
                                        
                                          quote: Originally posted by anupalavila thanks bklr for your valuable answerThanks and Regards Anu Palavila
  ur welcome   | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     Jai Krishna 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    333 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 06:52:04
                                          
  | 
                                         
                                        
                                          | select customerName,('PObox '+coalesce(customerPOBox,'')+' ,'+customerFaxNo)Contact from InventoryCustomerMasterJai Krishna  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     bklr 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    1693 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 07:08:29
                                          
  | 
                                         
                                        
                                          quote: Originally posted by Jai Krishna select customerName,('PObox '+coalesce(customerPOBox,'')+' ,'+customerFaxNo)Contact from InventoryCustomerMasterJai Krishna
  the above case is to avoid the pobox when customerpobox is nullbut ur query will return the pobox when customerpbox is null alsoonce check it  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     Jai Krishna 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    333 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2009-02-11 : 07:36:34
                                          
  | 
                                         
                                        
                                          | select customerName,(coalesce('PObox '+customerPOBox +' ,','')+customerFaxNo)Contact from InventoryCustomerMasterJai Krishna  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |