Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Empty strings 1

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
GB
What is the best way to test for empty strings ?

Code:
WHERE IsNull(@someVar,'0') = '0'

Or

Code:
WHERE LEN(@someVar) = 0
 
This is NOT an EMPTY string :)
This is a string that is NULL. What if you have:
@someVar = ''

So if you want to test for EMPTY and NULL strings use this:
Code:
IF ISNULL(@someVar,'') = ''

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top