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  | 
                             
                            
                                    | 
                                         IK1972 
                                          
                                         
                                        
                                        56 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2014-07-31 : 10:59:57
                                            
  | 
                                             
                                            
                                            | declare @address table(    AddressID int,    AddressType varchar(12),    Address1 varchar(20),    Address2 varchar(20),    City varchar(25),    AgentID int)insert into @address select 1, 'Home', 'abc', 'xyz road', 'RJ', 1 union allselect 2, 'Office', 'temp', 'ppp road', 'RJ', 1 union allselect 3, 'Home', 'xxx', 'aaa road', 'NY', 2 union allselect 4, 'Office', 'ccc', 'oli Com', 'CL', 2 union allselect 5, 'Temp', 'eee', 'olkiu road', 'CL', 2 union allselect 6, 'Home', 'ttt', 'loik road', 'NY', 3SELECT a.* from @address a where a.AddressID = 1FOR XML path('Addresses')SELECT a.* from @address a where a.AddressID = 9FOR XML path('Addresses')Issue:As you can see for second query where AddressID = 9 is not exists so xml is not generated but my expected result is for second query is<Addresses>  <AddressID />  <AddressType />  <Address1 />  <Address2 />  <City />  <AgentID /></Addresses>Thanks in advance for all your help.  | 
                                             
                                         
                                     | 
                             
       
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |