Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 transforming data that contains null to a text file

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-04-08 : 07:39:50
s writes "I'm trying to transform data from sql table to a text file , by using sql query.
Some of the fields in the source table are null ,and I want the text file to include "place holders" for them , for example if I have something like:
select a , null , b from tName
the text file should look like:aVal [spaces ] bVal ,
However when transforming the data I get something like : aVal bVal
(The column delimiter is tab and the file format is fixed field)"

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-04-08 : 07:44:44
Use the ISNULL() function to convert nulls to an alternate value.

Look it up in Books On-Line.

ISNULL('a','n/a') returns 'a'.

ISNULL(null, 'n/a') returns 'n/a'.

EXTREMELY handy function ... I use it all the time. Easier to spell than COALESCE ! (look up that one, too)

- Jeff
Go to Top of Page
   

- Advertisement -