SSIS to FlatFile

  • Hello I have a query that generates a result set in SMS, but when i use that query within a SSIS package to create a flatfile, there are no results?

    is there anything wrong, because I am confused.

  • can you give an example of the query you are running?

    tom

    Life: it twists and turns like a twisty turny thing

  • its a bespoke query, have you come across this problem before?

  • it's difficult to know without being able to see the sql itself.

    tom

    Life: it twists and turns like a twisty turny thing

  • select 'SKU,A,' + dbo.fn_digit(ItemID) + ',' + dbo.fn_digit(ItemID)+ ',' +

    SUBSTRING(Description, 1, 40) + ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,' + CID + ',

    ' + SID + ',,,,,,,' + CAST([Cost Price] As nVarChar(32)) + ',T,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'

    FROM items where storeexport = 0

  • are you hoping to make a comma separated file?

    Life: it twists and turns like a twisty turny thing

  • thats right in a carraiage return unix format

  • is the problem that the file you create is empty? have you check the data coming from the source using a data viewer?

    Life: it twists and turns like a twisty turny thing

  • Thats right, the file created is empty, but when I preview it, i can see data.

  • when you say you preview the query, is that in SSMS or using a data viewer in the data flow? (apologies if these questions seem basic or pointless, but sometimes just working through the basic questions can help unlock the answer).

    Tom

    Life: it twists and turns like a twisty turny thing

  • when using data viewer in data flow

  • so that would imply that the query is working fine, but there is some problem writing to the file.

    could you change the query and replace the single column with all the commas with separate columns using nulls or empty strings to create the dummy columns you require? then map these columns to individual columns in the file and let the connection manager deal with field and line separators?

    Life: it twists and turns like a twisty turny thing

  • Will this create the CR UNIX csv file format? and besides that column heads are not to exist within the file.

  • unfortunately, i don't have any experience in creating unix files so this might be where i sign off.

    i do know that you can switch column headers on or off in the connection manager (in the general tab there is a check box to set whether there are "column names in the first data row". also, you can set a file as unicode and also specify the row delimiter.

    tom

    Life: it twists and turns like a twisty turny thing

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply