Pathfinder

June 15, 2016

Compatible SQL to test for not null and not empty strings

WITH SampleData AS
    (SELECT 1 AS col1, CAST(NULL AS varchar(10)) AS col2
     UNION ALL
     SELECT 2, ''
     UNION ALL
     SELECT 3, 'hello')
SELECT *
  FROM SampleData
 WHERE NULLIF(col2, '') IS NOT NULL;
at 10:58 AM

No comments:

Post a Comment

Newer Post Older Post Home

More Post

  • ►  25 (5)
    • ►  Jun (5)
  • ►  20 (1)
    • ►  Apr (1)
  • ►  19 (3)
    • ►  Aug (2)
    • ►  Mar (1)
  • ►  18 (10)
    • ►  Nov (1)
    • ►  Aug (2)
    • ►  Jul (1)
    • ►  Jun (2)
    • ►  Apr (2)
    • ►  Mar (1)
    • ►  Jan (1)
  • ►  17 (11)
    • ►  Oct (1)
    • ►  Sep (1)
    • ►  Aug (2)
    • ►  Jun (1)
    • ►  May (3)
    • ►  Mar (1)
    • ►  Feb (2)
  • ▼  16 (46)
    • ►  Dec (3)
    • ►  Nov (4)
    • ►  Oct (2)
    • ►  Sep (15)
    • ►  Aug (4)
    • ▼  Jun (10)
      • Sql server tricks
      • MVC vs Sharepoint
      • Interface
      • When to use IEnumerable, ICollection, IList and List
      • Compatible SQL to test for not null and not empty ...
      • SOAP vs REST
      • Cursor Sample
      • T-SQL Code Formatter
      • Mobile compatibility test
      • ASP.NET MVC Terminology
    • ►  Apr (3)
    • ►  Mar (1)
    • ►  Feb (2)
    • ►  Jan (2)
  • ►  15 (4)
    • ►  Sep (1)
    • ►  Aug (1)
    • ►  Apr (1)
    • ►  Jan (1)
  • ►  14 (4)
    • ►  Nov (2)
    • ►  Jun (1)
    • ►  Jan (1)
  • ►  13 (10)
    • ►  Nov (2)
    • ►  Oct (2)
    • ►  Sep (1)
    • ►  Aug (2)
    • ►  Jul (1)
    • ►  Jun (1)
    • ►  May (1)
  • ►  11 (4)
    • ►  Nov (2)
    • ►  Oct (1)
    • ►  Sep (1)

Total Pageviews

Simple theme. Powered by Blogger.