Results 1 to 2 of 2

Thread: Datetime Substitutions

  1. #1

    Datetime Substitutions

    I am trying to substitute a null date value (Blasted 12/30/1899) in my select statement. I am using VS 2003 C#. The datasource is Foxpro.
    Any ideas !

  2. #2
    Regular Member
    Join Date
    Aug 1999
    Posts
    341
    I'm not too sure about the specifics in foxpro, but most DBs that use SQL have a ifnull(), nullif(), or coalesce() function that lets you do this. Typically they return the first parameter that is not null. Something like this:

    Code:
    SELECT COALESCE(NULL, 15);
    You'll have to check the foxpro documentation to see which function is provided.

    Alternatively, you try using a case statement in your select (depending on foxpro's support for SQL92). Like this:

    Code:
    SELECT CASE date_field 
                WHEN NULL THEN 'Some Date' 
                ELSE date_field 
           END, 
           another_field
      FROM some_table;

Similar Threads

  1. Isp Provider Insulted Me!!!!
    By Predatus in forum Network Security
    Replies: 11
    Last Post: 09-04-03, 09:37 AM

Bookmarks

Posting Permissions

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