Questions tagged [isnull]

`ISNULL` is a SQL function that replaces NULL with the specified replacement value.

ISNULL is a SQL function that replaces NULL with the specified replacement value.

Reference

MSDN Article

637 questions
150
votes
7 answers

is_null($x) vs $x === null in PHP

Possible Duplicate: What's the difference between is_null($var) and ($var === null)? PHP has two (that I know of, and three if you count isset()) methods to determine if a value is null: is_null() and === null. I have heard, but not confirmed,…
Explosion Pills
  • 176,581
  • 46
  • 285
  • 363
116
votes
10 answers

C# equivalent of the IsNull() function in SQL Server

In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new…
HAdes
  • 15,789
  • 18
  • 54
  • 74
75
votes
9 answers

Using ISNULL vs using COALESCE for checking a specific condition?

I know that multiple parameters can be passed to COALESCE, but when you want to to check just one expression to see if it doesn't exist, do you use a default or is it a better practice to use ISNULL instead? Is there any performance gain between…
JBone
  • 2,951
  • 10
  • 32
  • 45
54
votes
4 answers

how to check for null with a ng-if values in a view with angularjs?

i have this situation
but test.view== null doesn't work, neither just checking for test.view or test.view == '' any…
Patrioticcow
  • 23,784
  • 68
  • 202
  • 327
50
votes
4 answers

Equivalent of SQL ISNULL in LINQ?

In SQL you can run a ISNULL(null,'') how would you do this in a linq query? I have a join in this query: var hht = from x in db.HandheldAssets join a in db.HandheldDevInfos on x.AssetID equals a.DevName into DevInfo from aa in…
MartGriff
  • 2,623
  • 7
  • 36
  • 42
47
votes
6 answers

MySQL comparison with null value

I have a column called CODE in a MySQL table which can be NULL. Say I have some rows with CODE='C' which I want to ignore in my select result set. I can have either CODE=NULL or CODE!='C' in my result set. The following query does not return a row…
dev_musings
  • 981
  • 1
  • 7
  • 17
44
votes
8 answers

Is there a opposite function to ISNULL in sql server? To do Is not null?

I have this code in my select statement ISNULL(a.PolicySignedDateTime,aq.Amount) AS 'Signed Premium', But I want to see if "a.PolicySignedDateTime" is not null. Is there a easy function to do this which does not involve using a "if"…
Bobby
  • 2,450
  • 3
  • 17
  • 34
43
votes
5 answers

TSQL ORDER BY with nulls first or last (at bottom or top)

I have a date column which has some NULL. I want to order by the date column ASC, but I need the NULL s to be at the bottom. How to do it on TSQL?
Myurathan Kajendran
  • 567
  • 3
  • 7
  • 14
39
votes
5 answers

jQuery check if Cookie exists, if not create it

I cannot get this code to work I must be missing something pretty simple. I am trying to check to see if a Cookie exists, if it does {do nothing} if it doesn't {create it}. I am testing the cookie by including an alert on a page. Basically I do…
ToddN
  • 2,769
  • 14
  • 53
  • 93
31
votes
4 answers

Remove rows with empty lists from pandas data frame

I have a data frame with some columns with empty lists and others with lists of strings: donation_orgs donation_context 0 [] [] 1 [the research of Dr. ...] …
Ben Price
  • 477
  • 1
  • 7
  • 16
26
votes
2 answers

Django: filtering queryset by 'field__isnull=True' or 'field=None'?

I have to filter a queryset by a dynamic value (which can be None): may I simply write: filtered_queryset = queryset.filter(field=value) or shall I check for None: if value is None: filtered_queryset = queryset.filter(field__isnull=True) else: …
Don
  • 15,148
  • 9
  • 55
  • 91
25
votes
2 answers

Check if array value isset and is null

How to check if array variable $a = array('a'=>1, 'c'=>null); is set and is null. function check($array, $key) { if (isset($array[$key])) { if (is_null($array[$key])) { echo $key . ' is null'; } echo $key . '…
Bartek Kosa
  • 802
  • 1
  • 12
  • 25
22
votes
3 answers

Why is T-SQL ISNULL() truncating the string and COALESCE is not?

Given the following: SELECT ISNULL('XY' + NULL, 'ABCDEFGHIJ') -- Outputs ABC (Why?) SELECT COALESCE('XY' + NULL, 'ABCDEFGHIJ') -- Outputs ABCDEFGHIJ Why are these statements returning different results?
natenho
  • 4,150
  • 2
  • 21
  • 43
21
votes
2 answers

MySQL - How Do I Count Nulls and Not Nulls?

I have a simple table of installs: prod_code email install_slot If the install_slot is NULL, then it's an available install slot. Not null -- then, used slot. I need to return a result of total installs for a given product and email, as well as a…
Volomike
  • 21,378
  • 19
  • 99
  • 188
18
votes
1 answer

Peewee syntax for selecting on null field

I have researched this everywhere and can't seem to find an answer. I hope I haven't duplicated this (as it's my first question on SO). I am trying to write a select query with Peewee that would normally go ... WHERE foo = NULL; in SQL world. MySQL…
thaavik
  • 2,737
  • 2
  • 16
  • 24
1
2 3
42 43