As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [isnull]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
121 views

PostgreSQL WHERE IS NULL causes bad query plan

I have a PostgreSQL table with the following schema and indexes +---------+---------+-----------+----------+--------------+-------------+ | Column | Type | Modifiers | Storage | Stats target | ...
nick314's user avatar
  • 117
-1 votes
1 answer
224 views

Error while declaring procedure

When I run this query it returns me a count of null values of the column country (select sum(case when (country IS NULL) then 1 else 0 END) as 'null_flag' from city) whereas ...
Prachi Karekar's user avatar
0 votes
1 answer
64 views

Improve this statement using ISNULL

Beginner with SQL and trying to improve this using ISNULL instead of the longer statement? CASE WHEN c.FirstName IS NULL THEN '' ELSE c.FirstName END
Jude's user avatar
  • 1
1 vote
1 answer
33 views

Displaying null fields as 0 in mySQL select [duplicate]

I have a database that collects statistics from Usenet. When I do a basic select such as: select day, count(day) from statistics where month = 12 and year = 2020 group by day; I get the result +------+...
Neil Lombardo's user avatar
-2 votes
1 answer
2k views

Working with NULL Date Fields [closed]

I have a derived VARCHAR date field that I need to use for deriving another field, based off of whether or not the date field has a value. The derived date field is called "AmortDate" and I'm ...
Daylon Hunt's user avatar
-1 votes
1 answer
829 views

Problem with indexing null values

There is a table 'test' with ~ 10M records with field 'finish'. select count(*) from test where finish is null; count --------- 2485009 (1 row) I'd like to create index to speed up queries like ...
sim's user avatar
  • 139
2 votes
2 answers
65 views

Select IDS where all values can't be found in another table

Hey I'm pretty new to SQL and I've come up with a problem that I haven't been able to solve I'm trying to make a query to bring up ID's that have ALL null values and are located in another table. DB ...
Bino's user avatar
  • 23
-4 votes
1 answer
32 views

How to list not nullable unique column list in postgres DB? [closed]

I want the list of unique columns with not null constraint
Aravindharaj G's user avatar
-1 votes
1 answer
62 views

Replace NULLs with value

Here is my temporary table: CREATE TABLE #test123( c1 float, c2 float, c3 float, c4 float, c5 float ); INSERT #test123(c1,c2,c3,c4,c5) VALUES (2,3,NULL,1,2), (2,NULL,NULL,...
sqlNewie's user avatar
4 votes
2 answers
282 views

Extract rows of a table, that include less than x NULLs [duplicate]

I am working with a SQL Server database, which includes a lot of NULLs. To analyse my data, I want to extract all rows of the database table, that include less than x NULL marks (e.g. x=2). My ...
sqlNewie's user avatar
1 vote
1 answer
1k views

Try_Convert Datetime showing '1/1/1900', want to show space

How do I get try_convert datetime to display NULL when the input is space? I am getting two different results here. My intention is to show 'space' number query as Null also, just like first query. ...
user avatar
0 votes
1 answer
1k views

Display all fields with null values in a particular row in SQL Server

I have a requirement where I want to fetch and display all the fields with NULL value for a particular row in the table. Some thing like: select 'all columns with NULL' from table_xyz where ...
Shreesha's user avatar
1 vote
2 answers
6k views

Remove all Null values from Sql table at once

I am very new to Teradata and SQL environment. I am trying to remove all the null values from sql table in teradata using ISNULL(COLUMNNAME,0). But it gives an error that "the data type does not match ...
Kuljeet Keshav's user avatar
2 votes
1 answer
468 views

Where NULL IS NULL

I'm seeing a lot of where NULL IS NULL type conditions in code and I'm curious about the overhead that may be involved in this. So given SELECT * FROM table WHERE field = 'TERM' AND (NULL IS NULL OR ...
DecafDb's user avatar
  • 123
7 votes
2 answers
7k views

Count NULL values per row

I would like to count the number of null's present per row in a table without enumerating column names. For example: WITH t as (VALUES (NULL ,'hi',2,NULL,'null'), ('' ,'hi',2,3,'test'), (NULL ,'...
Edward Brown's user avatar
0 votes
1 answer
2k views

case when IsNull Alternatives?

Is there a way, to optimize this query, where several IsNull in relation with dates are used? Unfortunately the query is a way slow and actually I have no glue, how to make it way faster. case when ...
Tobias A.'s user avatar
3 votes
2 answers
876 views

Avoiding null comparisons in where clause

It's my impression that comparing to null limits the use of an index. We had a DBA come in and that statement was part of his notes, however no better example was given. If that statement is true, ...
rism's user avatar
  • 203
1 vote
1 answer
550 views

Difference in efficiency between NVL and IS NULL

I have the below query (showing the last part of the query). In the first example I get a result (which is not exactly as desired) but the results arrive within 10min. The second version results in an ...
Nickpick's user avatar
  • 177
2 votes
1 answer
2k views

Addition With Null Values

I have inherited a table that has NULL values for float fields, instead of a 0 value. I am doing some basic testing for querying, and in my tests both ISNULL() and COALESCE() present the same ...
user2676140's user avatar
0 votes
2 answers
536 views

How can I replace the following query with ISNULL function in SQL?

I have the following query. For performance optimization reasons I have been asked to replace the logic with ISNULL function in SQL. How can I achieve this? please advice. SELECT ...
AnOldSoul's user avatar
  • 471
1 vote
3 answers
4k views

Matching 3 columns in row - if one column is null then exclude it from comparison

A B C Equal 1 1 1 Y 2 2 NULL N Hi, I have 3 columns which I need to compare : Columns A,B,C. If these 3 columns are the same then column 'Equal' = 'Y' But, if a column is null, ...
Peter PitLock's user avatar