Ask a Question related to Coldfusion Database Access, Design and Development.
-
sblue #1
How to return default value for NULLs?
Hi,
I'm doing a left outer join and would like to replace the null values returned for the right table with a default value. Is that possible?
Blue
sblue Guest
-
#39365 [NEW]: getElementsByTagNameNS() does not return elements in a default namespace
From: z_rules55 at hotmail dot com Operating system: WinXP Professional PHP version: 5.2.0 PHP Bug Type: DOM XML related Bug... -
Default Search for 2 field values return all results?
Hi. I have two fields that users can search for. Either room number or Phone number. They can also put both a room number and a phone number and... -
Casting nulls
IF $int is null and I have a test If($int < 1) { //do some foobar } will $int be evaluated as a zero? IF I cast (int) $int.. will that turn a... -
Changing the default elementName for the return value of a Web Method
Hello Lets say I have a WebMethod with the following Attributes public short method() { return 1; } -
Problem with nulls
I am passing values from a form to an asp page that has the code to update underlying records with all changes. How can I update blank fields that... -
mxstu #2
Re: How to return default value for NULLs?
The syntax depends on your database type. Try ..
SELECT COALESCE(aTextColumn, 'SomeDefaultValue') AS aTextColumn
SELECT COALESCE(aNumericColumn, 0) AS aNumericColumn
.......
mxstu Guest
-
SQLMenace #3
Re: How to return default value for NULLs?
Just so that you know ISNULL() will do the same and is ANSI-SQL
SELECT ISNULL(aTextColumn, 'SomeDefaultValue') AS aTextColumn
SELECT ISNULL(aNumericColumn, 0) AS aNumericColumn
SQLMenace Guest
-
jorgepino #4
Re: How to return default value for NULLs?
just to make sure NULL value and '0' value are not the same
if you want to the data from the table to to have a value of '0' when no
value is assigned
you should set the table to have a defaul value of zero instead of NULL it
will same time and code
jorgepino Guest
-
jarl@mimer.com #5
Re: How to return default value for NULLs?
COALESCE is ANSI SQL!!! (Feature 261-04, as specified by the ANSI/ISO
SQL-99 and SQL-2003 standards.)
ISNULL is vendor specific.
/Jarl
jarl@mimer.com Guest
-
philh #6
Re: How to return default value for NULLs?
jorgepino, the query is the result of an OUTER JOIN. There are no records in the table that match the query condition; that's why sblue has to handle NULL results.
philh Guest
-
mxstu #7
Re: How to return default value for NULLs?
>Just so that you know ISNULL() will do the same and is ANSI-SQL
SQLMenace,
Actually I believe it COALESCE() that is ANSI-SQL and ISNULL() is the proprietary function.
mxstu Guest



Reply With Quote

