Solved

sql server 2008  NULLS in Data

Posted on 2014-10-04
3
565 Views
Last Modified: 2014-11-03
HI all,
I'm working on a data migration project and have to transfer data to clients sql server. In my source I have lot of NULL values in some of the columns. what is the best practice. Where ever nulls are in source should I replace them with ''  and then send them the data OR leave nulls as it is as they can query nulls easily than empty fields?
What is the common and best practice. What if they export these nulls to excel. Will it show them nulls too.  Please suggest.
0
Comment
Question by:BI 0824
3 Comments
 
LVL 12

Accepted Solution

by:
James Elliott earned 150 total points
ID: 40361962
NULL is the absence of data. I personally would not change that. SQL handles nulls very well.

Here are some functions that do it:

http://www.w3schools.com/sql/sql_null_values.asp
0
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 150 total points
ID: 40362170
The topic of NULL vs. '' or 0 or some other character is always a big topic of debate.  Most developers would prefer the NULLs, as there is a big difference between the absense of data (posted above) and a zero, but in some cases based on business need another character is preferred.   Most business people have no frEEaking clue what 'NULL' means, and it only confuses them.

>What if they export these nulls to excel.
Excel often interprets a NULL as the string 'NULL', and write it out when a data set is exported to Excel.  In that case it may be advisable to write a query that replaces the NULL values with '', and export the query.

>What is the common and best practice
Use the ISNULL or COALESCE functions to convert NULLs into some other value.
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 200 total points
ID: 40364173
From a purely data perspective, NULLs are extremely valuable in differentiating between unknown/missing data and known data that is actually 0 or blank ('').  From the data side, NULLs are in invaluable advantage that should not be given up.

From the purely development and querying side, NULLs are a royal pita.  Writing queries to properly handle NULLs can be quite tricky, even for those who moderately understand NULLs, but are not really expert at it.  This is particularly true for "not equal" conditions.  For example, if you write " state <> 'FL' " in a query, you might expect to see NULL states, but you won't.

Then what to do?  I suggest that data accuracy/integrity is the most important part of a database.  Therefore, I'd opt to use NULLs and give clear guidelines to developers/power users that write queries on how to properly deal with NULLs.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now