SQL 2K5, Results To CSV, NULL Values?
When you try to save results in a grid to a csv file, whenever there are NULLs present, the value actually shows up in text as NULL in the CSV output. What can I do, if anything, to have it save as an empty field with nothing in it?
If I have data in three columns: 1, (null), 2
the result in the file is :1,NULL,2
where I want the output to be : 1,,2
Would make importing much easier to have nothing there than a NULL in text, especially in a numerical column.
Re: SQL 2K5, Results To CSV, NULL Values?
You could try using the IsNull function
ISNULL ( check_expression , replacement_value )
Sample usage
Code:
SELECT ISNULL(Column2, ''))
FROM Table1
1 Attachment(s)
Re: SQL 2K5, Results To CSV, NULL Values?
I would suggest using the Export Data function found when you right click on the database. Select Tasks, followed by Export Data.
In here you will be able to select your source (Database) and destination (Flat File), as well as how you want to extract it. You can also specify if you want a full table copy or use a piece of SQL to transfer the data.
The finished csv file will have blanks where the NULLS should be. :thumb: