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 |
|
vision.v1
Yak Posting Veteran
72 Posts |
Posted - 2009-07-31 : 09:07:31
|
| Hi, I have a table #temp1 with two colsTableName : #temp1name city---- ----aaa conebbb ctwoNULL NULLNULL NULLccc cthreewhen i select table likeselect * from #temp1 it will display all recordsname city---- ----aaa conebbb ctwoNULL NULLNULL NULLccc cthreebut my requirement is when i select the table it should ignore the records for which all the columns are NULLresult should be:name city---- ----aaa conebbb ctwoccc cthreeplease give replys... |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-31 : 09:14:50
|
select * from #temp1 where name is not null and city is not null KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-07-31 : 09:25:46
|
| Another wayselect * from #temp1 where Coalesce(city,name)is nullPBUH |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-31 : 09:37:42
|
| select * from #temp1 where Coalesce(city,name,'') <> '' |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-07-31 : 09:44:27
|
| oops sorry I made a mistake in my previous postselect * from #temp1 where Coalesce(city,name)is not nullPBUH |
 |
|
|
|
|
|