home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,984 of 19,505   
   Erland Sommarskog to tshad   
   Re: Nulls to 0 in Pivot   
   27 Oct 10 00:00:04   
   
   From: esquel@sommarskog.se   
      
   tshad (tfs@dslextreme.com) writes:   
   > I am using a pivot (dynamically) and am getting NULL results for some   
   > values.   
   >   
   > I want to change the NULLs to 0, but keep getting errors.   
   >   
   > In the following: @strList contains the pivot columns.   
   >   
   > This one works fine except for the nulls:   
      
   Have a look at http://www.sommarskog.se/dynamic_sql.html#Crosstab to   
   get the pattern for crosstab queries. The section also includs a link   
   to Itzik Ben-Gan's sp_pivot.   
      
   The PIVOT keyword does not appear in any of the places. I'm afraid   
   that I have never bothered to learn that syntax.   
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca