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 |
|
Gili
Starting Member
42 Posts |
Posted - 2007-06-28 : 05:26:26
|
| Hi,i wanna retrieve number of null column in table .what is the way to do this?thanks. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-28 : 05:31:57
|
| Number of Null column? What do you mean? Count of Null values?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Gili
Starting Member
42 Posts |
Posted - 2007-06-28 : 05:33:20
|
| yes count of null values in table.10x. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-28 : 05:36:03
|
| [code]Select count(*) from table where column is NULL[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Gili
Starting Member
42 Posts |
Posted - 2007-06-28 : 05:38:51
|
| i write this query :Select count(*) from Tbl_014_Accountingwhere column is NULLand i get this err:Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'column'.i don't know the reason.??10x. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-28 : 05:43:24
|
| Replace column by actual column nameMadhivananFailing to plan is Planning to fail |
 |
|
|
Gili
Starting Member
42 Posts |
Posted - 2007-06-28 : 05:44:49
|
| ammm...i'm looking for retrieve count of all column that are they null in table.can i do that.??? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-28 : 05:50:21
|
| [code]SELECT SUM(CASE WHEN Col1 IS NULL THEN 1 ELSE 0 END) AS Col1, SUM(CASE WHEN Col2 IS NULL THEN 1 ELSE 0 END) AS Col2, SUM(CASE WHEN Col3 IS NULL THEN 1 ELSE 0 END) AS Col3, SUM(CASE WHEN Col4 IS NULL THEN 1 ELSE 0 END) AS Col4, SUM(CASE WHEN Col5 IS NULL THEN 1 ELSE 0 END) AS Col5FROM Table1[/code]Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|