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 |
samir.first
Starting Member
34 Posts |
Posted - 2014-06-11 : 05:55:52
|
when i used select statement with if Exists the query is very very slowand takes 10 minand when i used the query without if exists clause it runs instantlyif exists (select null from table)select 1elseselect 0==================================select null from table |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2014-06-11 : 06:40:33
|
Where is the error?Where is the question?Where is the sense of "select null from table"?I really don't know how to help you, can you make it more clear please? :) Too old to Rock'n'Roll too young to die. |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2014-06-11 : 12:17:34
|
Why are you using if exists here no need...Select *From [dbo].[YourTable]Where [ColumnName] is null Or [ColumnName] = ''We are the creators of our own reality! |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2014-06-11 : 12:30:56
|
Try this:With findnullsas(Select WithNulls = CaseWhen yourcolumn Is Null OR yourcolumn = ''Then 1 else 0EndFrom [dbo].[yourtable]) SelectSum(WithNulls) 'TotalNulls'From findnullsWe are the creators of our own reality! |
|
|
|
|
|