Questions tagged [isnull]

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

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

The ANSI/ISO SQL standard function COALESCE serves the same purpose, and is widely implemented.

Reference

MSDN Article

706 questions
-1
votes
1 answer

MySQL WHERE x OR IS NULL not working

select * from inventory.home_picture_types hpt left join inventory.home_pictures hp on hp.home_picture_type_id = hpt.id where hp.id IS NULL; This query works on vagrant/homestead, and returns the home_picture_types with NULL home_picture values…
bi4nchi
  • 519
  • 1
  • 4
  • 7
-1
votes
3 answers

SQL NULL insertion not working

I'm having some odd SQL problems when inserting new rows into a table. I have set some columns to NULL, as I have with another table in my database. Obviously when no data is passed through on insertion it should enter NULL into the record, however…
Liam-FD
  • 67
  • 9
-1
votes
1 answer

CASE WHEN IS NULL

I want to put the PlaceTypeId = 18 in the column PlaceType.PlaceTypeId if is it null. I tried with this case null but it don't work. Am I doing something wrong? SELECT DoctorsAddress.AddressId, DoctorsAddress.Address, PostalCode.Locality, (CASE…
Mara Pimentel
  • 317
  • 1
  • 8
  • 14
-1
votes
3 answers

isnull not working SQL Server

I have the following problem , I'm doing a select with multiple where. example: select isnull(fechamov,0) from movimientos where (provedor='1000' and depto='20') or (provedor='1001' and depto='200') result: |fecha de…
-1
votes
1 answer

ISNULL() for calculated column in Full Join. SQL Server

I'm currently facing a problem when calculating the standard deviation in an SQL Server statement. My problem: I have two tables. T1: Reg_Month --------- 1 2 3 ... T2: Product Month Consumption ------------------------------- ProdA 1 …
user4985694
  • 13
  • 1
  • 4
-1
votes
1 answer

How to use ISNULL or COALESCE function when using a PIVOT in MS SQL

I have a table with the below mentioned schema: InvoiceID int PK, Date datetime, Amount Money I now create a table which contains the Year, Month and Amount from the table above. Year | Month | Amount 2014 | Dec | 10 I then pivot this table…
Sid
  • 141
  • 3
  • 13
-1
votes
2 answers

postgres replace isnull with integer

I am trying to replace empty cells in a column (type int) with an integer. I am using Postgres. I have been able to replace them in a 'select' query using coalesce, but not sure how to alter the records permanently.
user3770062
  • 153
  • 1
  • 1
  • 12
-1
votes
1 answer

Replace null returned date with a DateTime.now with C# and Linq

I have a Linq Query like this var db = new Models.Mydb(); var model = from c in db.VW_myTable select new { COdUser = c.CodUser, Entrada = c.StartHour, Salida = c.EndHour, fecha = c.DATE }; When i get Null values in the DATE…
HHungria
  • 481
  • 4
  • 6
-1
votes
1 answer

Understanding the working of "IsNull" function in SQL

Access Code iif(Format(SUM(Field))='',0,SUM(Field)) SQL code IsNull(SUM(Field),0) As Amt In the Access Code statement it is clearly shown that the query has to run SUM function 2 times to get SUM and 0 if records are blank. But I want to know that…
Agent_Spock
  • 1,107
  • 2
  • 16
  • 44
-1
votes
1 answer

SQL Find the Max value of the sum of two columns

This is a two part question ... Firstly I'm stuck on the logic, the second part is a formatting. The question reads as such: Display all jobs and the maximum total pay (salary + commission) for each job. The table is called employee -- and the…
YelizavetaYR
  • 1,611
  • 6
  • 21
  • 37
-1
votes
1 answer

Warning: Null value is eliminated by an aggregate or other SET operation in SQL

I am sorry that there are lots of questions on this already on the stack overflow. But They did not solved my issue regarding to the null value. I want to eliminate Null value from the output. I have already used below technique for my query but…
Hardik Parmar
  • 1,053
  • 3
  • 15
  • 39
-1
votes
1 answer

use of IsNull with date

I have the following TSQL code: Declare @MyDate datetime Select @MyDate = ISNULL(T.requireddate, Convert(DateTime, '01/01/2013', 101)) from myTable T where T.somekey = somevalue Select @MyDate The output is NULL. Why isn't it 01/01/2013?
DeveloperM
  • 1,129
  • 7
  • 17
  • 30
-1
votes
4 answers

If null return 0

I am trying to modify this query to return a row with '0' printed in either one or all of the rows when no data is returned. I've tried using ISNULL() but I am not getting anywhere. SELECT DISTINCT SA.DELETED, PAT.VERSION,…
Ben
  • 153
  • 2
  • 6
  • 18
-2
votes
2 answers

Is there a way to return a value instead of blank for SQL?

I am trying to do a HTML table but i am having troubles where it does not return a value. This example shows my result.Sample Image Is it possible to script that if there isnt any result, it will return 0? I tried ISNULL method and it does not…
Rickyc
  • 11
  • 2
-2
votes
1 answer

How can I avoid using two iSNulls

I am Trying to not use two isnulls since it is making my query extremely slow. what better ways are there to write the following? [Example] = CAST (isnull(ap.CustomDate2, (isnull(ap.CustomDate10, (Select top 1 sts.times …
sor
  • 15
  • 2