+ Reply to Thread
Results 1 to 2 of 2

SQL: How do I replace NULL ( empty ) with zero in a sql query. For instance:

  1. #1
    Registered User
    Join Date
    07-13-2016
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    27

    SQL: How do I replace NULL ( empty ) with zero in a sql query. For instance:

    My VBA recordset can't handle empty tables so I want to solve the problem by conding my SQL queery differently:

    I have an sql querie:
    Select top 1 variable1 from table1
    where variable1 = X.

    X is a certain value. The queerie is returning a table only with one column with one observation namely X.
    If 'variable1' does not have any value equal X then the qurie will return an empty table. If that occur; How do I then make my table return 0 instead?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: SQL: How do I replace NULL ( empty ) with zero in a sql query. For instance:

    If 0 is a value number, try
    where variable1 IS NOT NULL

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replace the last instance
    By WT2008 in forum Excel General
    Replies: 6
    Last Post: 11-03-2020, 07:00 PM
  2. [SOLVED] Empty cell (null value)
    By Monza Misfit in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-25-2016, 10:38 PM
  3. [SOLVED] Replace empty string with null
    By anteagles20 in forum Excel General
    Replies: 7
    Last Post: 04-08-2014, 07:16 AM
  4. Find a cell that has a null value, and replace with an empty string.
    By skania in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2013, 12:49 PM
  5. If null be empty
    By hawkins in forum Excel General
    Replies: 1
    Last Post: 06-22-2012, 12:48 PM
  6. How to test the entire row if it is empty or null?
    By annir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2008, 09:28 PM
  7. Code to replace null and not null strings
    By tigertim71 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2008, 05:07 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1