Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss Content Posted by James Travis
»
Is there any difference between a NULL and a...
Is there any difference between a NULL and a Blank field in MS SQL
Rate Topic
Display Mode
Topic Options
Author
Message
shameersinbox
shameersinbox
Posted Tuesday, October 14, 2008 4:20 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, August 29, 2012 12:28 AM
Points: 11,
Visits: 90
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
Post #585323
vyas
vyas
Posted Tuesday, October 14, 2008 4:36 AM
Hall of Fame
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:02 AM
Points: 3,131,
Visits: 1,056
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 = ' '
Post #585333
rajasekhar.bollareddy
rajasekhar.bollareddy
Posted Friday, February 25, 2011 3:30 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, April 29, 2013 5:59 AM
Points: 3,
Visits: 96
insert into employee(emp_no,emp_fname,emp_lname,dept_no) values(29346,null,'james','d2')
10102 ann jones d3
18316 john barrimore d1
25348 matthew smith d3
29346 james james d2
29347 NULL james d2
insert into employee(emp_no,emp_lname,dept_no) values(29346,'james','d2')
10102 ann jones d3
18316 john barrimore d1
25348 matthew smith d3
29346 james james d2
29347 NULL james d2
so no difference both are same
Post #1069487
Carlton Leach
Carlton Leach
Posted Friday, February 25, 2011 4:43 AM
SSC Eights!
Group: General Forum Members
Last Login: 2 days ago @ 9:58 AM
Points: 863,
Visits: 1,028
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.
Post #1069509
ALZDBA
ALZDBA
Posted Friday, February 25, 2011 5:24 AM
SSCertifiable
Group: General Forum Members
Last Login: 2 days ago @ 2:13 PM
Points: 6,866,
Visits: 8,071
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
Jul 13
Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere
-
How to post Performance Problems
-
How to post data/code to get the best help
-
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
Post #1069520
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.