
304 PUZZLE 73 A LITTLE DATA SCRUBBING
PUZZLE
73 A LITTLE DATA SCRUBBING
This came in as a data-scrubbing problem from “Stange” at SQL
ServerCentral.com. He is importing data from a source that sends him
rows with all
NULLs. And, no, the source cannot be modified to get rid of
these rows on the other side of the system. After staging this data into
SQL, he wants to identify the
NULL rows and remove them. His fear was
that he would have to hard-code:
SELECT *
FROM Staging
WHERE col1 IS NULL
AND col2 IS NULL
AND col3 IS NULL
etc.
AND col100 IS NULL;
Answer #1
He was playing around with passing the <tablename> as a parameter
and then interfacing ...