﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / SSIS Text qualifier question / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 10:05:02 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>[quote][b]Randy Doub (2/20/2013)[/b][hr]I read elsewhere that since a flat file is a text file, if you use a Text Qualifier it will be applied to every column.So here's what works...  remove the Text Qualifier and as a derived column use:mycol !="" ? "\"" + mycol + "\"" : mycolThis adds two to the length of every column with data.  I have some datetime data types in the table that got converted to char(10) for formatting in the select query and I was failing with a truncation error on them.  I could not edit the length in the Derived Column Transformation Editor.So I tried mycol !="" ? DT_STR(&amp;lt;len+2&amp;gt;,1252)("\"" + mycol + "\"") : mycol.  It didn't fail, but gave me "10/09/201 in the date columns in the output file.  Not sure what I was doing wrong there.So I changed the select query to pad all the columns giving ample space for the max data plus the quotes.  Ex: convert(varchar(50),convert(varchar(10),datetimeColumn,101)) as mycol.Learned a [u]little[/u] more about SSIS Expression Language today!Thanks for all your time and effort.[/quote]Randy, just watch out for when mycol contains any double quotes, then you have a problem...</description><pubDate>Wed, 20 Feb 2013 17:05:49 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>I read elsewhere that since a flat file is a text file, if you use a Text Qualifier it will be applied to every column.So here's what works...  remove the Text Qualifier and as a derived column use:mycol !="" ? "\"" + mycol + "\"" : mycolThis adds two to the length of every column with data.  I have some datetime data types in the table that got converted to char(10) for formatting in the select query and I was failing with a truncation error on them.  I could not edit the length in the Derived Column Transformation Editor.So I tried mycol !="" ? DT_STR(&amp;lt;len+2&amp;gt;,1252)("\"" + mycol + "\"") : mycol.  It didn't fail, but gave me "10/09/201 in the date columns in the output file.  Not sure what I was doing wrong there.So I changed the select query to pad all the columns giving ample space for the max data plus the quotes.  Ex: convert(varchar(50),convert(varchar(10),datetimeColumn,101)) as mycol.Learned a [u]little[/u] more about SSIS Expression Language today!Thanks for all your time and effort.</description><pubDate>Wed, 20 Feb 2013 14:51:57 GMT</pubDate><dc:creator>Randy Doub</dc:creator></item><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>Yea, they are empty string before the derived column transformationand NULL after the derived column transformation.And the result is all columns quoted.Screen shots are attached.In the attached gifs you can see column EdiCarrier is one of the culprits.  This columns has data in some rows, but not all.  So I changed the query to only select rows where EdiCarrier = '' wondering if the column was NULL for [u]every[/u] row, might it make a difference.  There was no change in the behavior.  I also deleted the flat file connection mgr and recreated it.  I've seen it where it seems like a flat file connection definition gets "stuck" after making edits to it.</description><pubDate>Wed, 20 Feb 2013 12:25:11 GMT</pubDate><dc:creator>Randy Doub</dc:creator></item><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>Hm.  The couple of semi-official things I've seen seem to point to that functioning.  Very strange.Can you check the dataviewer right before the outbound flat file and make sure that the columns you have mapped are actually null?</description><pubDate>Wed, 20 Feb 2013 10:42:11 GMT</pubDate><dc:creator>Evil Kraig F</dc:creator></item><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>I couldn't get that to work.  I mean the syntax is good, but I got the same result.  Its true that these are 0-length strings.  So to make them NULL I changed the select query to:case when ltrim(rtrim(mycol)) = '' then NULL else ltrim(rtrim(mycol)) end as mycol.In the preview I saw the NULL value, but it still got quoted.  Seems like the Text Qualifier in the flat file connection manager is overriding everything.</description><pubDate>Wed, 20 Feb 2013 09:58:09 GMT</pubDate><dc:creator>Randy Doub</dc:creator></item><item><title>RE: SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>I believe you can use a derived column to null the field before it goes outbound.  You've got a 0-length in there and that's what's trying to send, if my faulty memory serves me correctly.Basically something like this:TRIM(cola) == "" ? (DT_STR,&amp;lt;len&amp;gt;,1252)NULL(DT_STR,&amp;lt;len&amp;gt;,1252) : cola</description><pubDate>Wed, 20 Feb 2013 01:33:46 GMT</pubDate><dc:creator>Evil Kraig F</dc:creator></item><item><title>SSIS Text qualifier question</title><link>http://www.sqlservercentral.com/Forums/Topic1421848-391-1.aspx</link><description>I'm trying to replace an existing function with an SSIS package.  Rows are exported to a comma delimited flat file for archiving and deleted from the source table.The current method produces a file with data quoted and blank columns not quoted.Ex "data1","data2",,"data4"I set the Text Qualifier on my Flat File Connection Mgr to " But I get this: "data1","data2","","data4"All columns in the Flat File Connection Mgr are strings.I don't normally quote text on an export, but since I'm mimicking another process I thought I'd try and be exact.Can this be done?Thanks all.</description><pubDate>Tue, 19 Feb 2013 14:14:21 GMT</pubDate><dc:creator>Randy Doub</dc:creator></item></channel></rss>