Solved

DTS Package Help - NULL values

Posted on 2007-11-19
6
589 Views
Last Modified: 2013-11-30
I have a DTS package that is taking a view and writing it to a .txt file. It should be very straight forward but the .txt file is showing some weird results when dealing with NULL values.

In my view, some of the columns have text, some of the columns are always NULL, and some have a CASE statement that determines whether there is text in the field or if the value is NULL. The view looks fine. All fields with NULL values show up that way.

However, when the DTS package writes the view to the text file I have the problem. The fields with text are written properly, the fields with NULL are also presented properly. However, when the fields that have been determined by the CASE statement are written, if the field has been determined to be NULL it gets written with text delimiters '' instead of completely NULL. This does not happen with the other fields.

What am I missing? How do I get the DTS package to write the NULL fields to the text file without the text delimiters?

Thanks!

0
Comment
Question by:EpiKAC
[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
  • 2
6 Comments
 
LVL 8

Expert Comment

by:digital_thoughts
ID: 20314180
It sounds like the CASE statement return isn't returning a NULL value, but rather a blank '' value, are you returning NULL is the case statement?

CASE WHEN Value='Something' THEN NULL ELSE Value END
0
 

Author Comment

by:EpiKAC
ID: 20314712
No, here's one of the case statements:
CASE WHEN dbo.tblAmt.rcomenh <> '1' THEN 'arial' ELSE NULL END AS pScrollingTextFont
0
 
LVL 6

Expert Comment

by:Spot_The_Cat
ID: 20316620
Hi,

When I test this I find that any fields in the DTS's text file  that are defined as quoted come out quoted irrespective of whether they have a case statement.

In the example I just tried, the first record with <NULL> came out as "" in the text file and the second record as "text". My CASE statement does exactly the same unless I define the column as non quotable.

So maybe I've misunderstood your query but that's exactly the behaviour I'd expect to see.

Spot
0
 
LVL 6

Accepted Solution

by:
Spot_The_Cat earned 125 total points
ID: 20316644
PS. - the 'ELSE NULL' is not required.

eg.

CASE WHEN dbo.tblAmt.rcomenh <> '1' THEN 'arial' END AS pScrollingTextFont

provides the same result.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

635 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