Results 1 to 5 of 5

Thread: [RESOLVED] isnullorwhitespace?

Threaded View

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Resolved [RESOLVED] isnullorwhitespace?

    MSSQL 2008.
    I mean I can do in with when but how can I simulate a nullorwhispace when creating a view?

    Currently I'm doing it this way. Is it acceptable?

    Code:
    Create View 
    
    SELECT...
    
    case when person_suburb ='' THEN NULL
    ELSE ISNULL( Cast( SUBSTRING(person_suburb,Charindex('FD',person_suburb)+5,8) as date),null) END as FirstDate
    
    FROM ...
    Not I'm also breaking a nvarcahr substring to date the issue is that if I use just ISNULL, any empty value '' will produce '1900-01-01' but I need it to produce null.
    Last edited by sapator; Apr 29th, 2024 at 08:23 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width