October 14, 2008 at 4:20 am
My question is, is there any difference between a NULL and a Blank
field in MS SQL or are they the same?
I have faced some problems while retrieving the records from the database.How to overcome......
Any one help
Thanks
Shameer
October 14, 2008 at 4:36 am
Both are different.Null is value which is unknown.
If you want to extract the null values use is null
If you want to extract blank values use = ' '
February 25, 2011 at 3:30 am
insert into employee(emp_no,emp_fname,emp_lname,dept_no) values(29346,null,'james','d2')
10102annjonesd3
18316johnbarrimored1
25348matthewsmithd3
29346jamesjamesd2
29347NULLjamesd2
insert into employee(emp_no,emp_lname,dept_no) values(29346,'james','d2')
10102annjonesd3
18316johnbarrimored1
25348matthewsmithd3
29346jamesjamesd2
29347NULLjamesd2
so no difference both are same
February 25, 2011 at 4:43 am
rajasekhar.bollareddy (2/25/2011)
so no difference both are same
An empty string an NULL are the same? Nope.
As stated NULL is an unknown value not an empty string (we know it's a string, we know it's empty).
If your having trouble retrieving things from a column that could be either use ISNULL (look in books online). Use with caution as this can be a performance nightmare.
Carlton.
February 25, 2011 at 5:24 am
If to you NULL = '' then declare you column NOT NULL !! (maybe even add "with default '' )
there are some nice article regarding NULL and its impact for mistakes .... to happen ....
-http://www.sqlservercentral.com/articles/Advanced+Querying/2829/
- http://www.sqlservercentral.com/articles/T-SQL/understandingthedifferencebetweenisnull/871/
- http://www.sqlservercentral.com/articles/ANSI_NULLs/69234/
- http://www.sqlservercentral.com/articles/Advanced+Querying/gotchasqlaggregatefunctionsandnull/1947/
- http://www.sqlservercentral.com/articles/Advanced/2921/
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply