What is the result, when NULL is compared with NULL?
Answer Posted / gaurav arora
The answer-6 is quite matching with my stuff. Let me clear
it in more writting:
1. When we compare two nulls then the result
always 'false'. The main reason is the null is not a value
its neither an empty nor a empty space, so the actual
result is null which places as null.
2. When we compare a null with another which has some value
like some int value then the result is false. The actual
result is false and not null.
Consider the following examples:
--null = null is null which is false
Declare @intNull1 int
Set @intNull1 =null
Declare @intNull2 int
Set @intNull2=null
If @intNull1=@intNull2
Print 'null = null is true'
Else
Print 'null = null is false'
--Now assign some value
Set @intNull1 = 1
If @intNull1=@intNull2
Print 'null = int value is true'
Else
Print 'null = int value is false'
Thanks,
Gaurav Arora
http://stuff4mdesktop.blogspot.com/
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is the difference between execution of triggers and stored procedures?
what are set operators in sql? : Sql dba
What type of database is cloud sql?
How will you distinguish a global variable with a local variable in pl/sql?
What is coalesce sql?
Mention what are the benefits of pl/sql packages?
Can I copy :old and :new pseudo-records in/to an oracle stored procedure?
what are all the different types of indexes? : Sql dba
Can a composite key be null?
What is the process of debugging?
How do I order columns in sql?
What is the syntax to add a record to a table?
What pl/sql package consists of?
What are the datatypes available in pl/sql ?
define sql update statement ? : Sql dba