Link to home
Create AccountLog in
Avatar of programmher
programmher

asked on

SSIS Package Flat File Output Question

I am using SSIS to output results from a query to a flat file.  I need the results to output as:   The Help Guru|7.28||||||||.

Instead, the output is :   The Self Help Guru|7.28|

How do I get my data to output as The Help Guru|7.28||||||||?

It looks like my blank fields are not being displayed with empty pipes.
Avatar of lcohan
lcohan
Flag of Canada image

You need to set the field dilimiter in your SSIS task to use the pipe character
Are all those fields NULLs? You may need to change that to empty string '' instead
Avatar of programmher
programmher

ASKER

lcohen,

I have set my delimiter to pipes in my SSIS package.

I also set my empty fields to empty strings ('') and those fields were still excluded from my flat file output.
If xp_cmdshell is enabled in your SQL then you could try explicit SQL like in example below where you can replace column list and tablename in the select statement:

exec master..xp_cmdshell N'sqlcmd -E -Q"select name,''|'',database_id,''|'',source_database_id,''|'',owner_sid,''|'',create_date from master.sys.databases" -h-1 -s"," -W -o"c:\output.txt"'--, no_output
xp_cmdshell is not  enabled
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
lcohan,

Thanks for the above - I will check and let you know!
Lcohan,

Your suggestion won't work - compliance issue.  I also noticed an additional issue.  All of my fields aren't displaying when exported to the flat file.  Of the 20 fields displayed, only 12 are displaying.  It's almost like once the output gets to a NULL value, it ignores everything after that.