Solved

sql server 2008  NULLS in Data

Posted on 2014-10-04
3
572 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 66

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

617 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