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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Null vs empty

Author  Topic 

sqlcool
Starting Member

2 Posts

Posted - 2008-11-07 : 00:41:48
Hi there,

Could any 1 help me know how to write a best checking method for the below code (keywords is NULL) OR (keywords = '')

is there any better way of doin it. pls condider the performance aspect as well

Cheers

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-07 : 00:53:05
NULLIF(col,'') IS NULL
Go to Top of Page

sqlcool
Starting Member

2 Posts

Posted - 2008-11-07 : 01:08:00
ta buddy
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-07 : 01:20:08
Cheers
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-07 : 01:41:17


To make use of index, you can use

where (keywords is NULL) OR (keywords = '')


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-07 : 01:42:45
If you want omit Null or empty use

where keywords>''


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -