Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you do this in SQL Server 2000?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00740729
Message ID:
00740733
Views:
10
>SELECT iif(isempty(field1),0,1) as myfield FROM mytable
>
>I want to use IIF and isempty in SQL 2000

There's no empty() function in Sql Server. For character field you can use LEN(myfiled) = 0 to check if it's empty. CASE function can be used in place of IIF(). It's even better than IIF() because you can check multiple conditions w/o embeded calls to CASE function.
SELECT CASE WHEN LEN(filed1)=0 THEN 0 ELSE 1 END AS myfield ;
  FROM mytable
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform