定义要在SQL Server中导入的csv文件的文本分隔符

时间:2015-06-25 09:50:43

标签: sql-server sql-server-2008 csv ssis flat-file

我在将csv文件导入SQLServer数据库时遇到了一些麻烦。我希望能解决我的问题。

源文件:

  • 包含|的文本文件在所有领域举行的会议
  • 每行都有一个tabstopp(新行也以新行开头)

以下是csv文件的示例行

FROM @classes AS c
CROSS APPLY (
SELECT TOP (@0) _entry_id, _guid, _sid, _path, _display_name, _name, _description, _account_name, _group_type, _is_admin, _user_account_control 
FROM ad._active_directory_entries_418 AS e WHERE _class_id = c._class_id AND (_path LIKE N'%DC=octo,DC=local' COLLATE Latin1_General_CI_AS OR _path LIKE N'%DC=testdom,DC=local' COLLATE Latin1_General_CI_AS OR _path LIKE N'%DC=protected-networks,DC=local' COLLATE Latin1_General_CI_AS)
AND (( PATINDEX(@searchParam0, COALESCE(e._name, '') COLLATE Latin1_General_CI_AI) <> 0  OR  PATINDEX(@searchParam0, COALESCE(e._display_name, '') COLLATE Latin1_General_CI_AI) <> 0  OR  PATINDEX(@searchParam0, COALESCE(e._account_name, '') COLLATE Latin1_General_CI_AI) <> 0 ) OR _entry_id IN (SELECT _entry_id FROM @entries))
) AS e 
OUTER APPLY (
SELECT * FROM
(SELECT _value, n FROM ad._active_directory_entry_properties_418 AS p 
INNER JOIN @propertiesToRead AS ptr ON ptr.id = _name_id
WHERE _property_id IN (SELECT _property_id FROM ad._active_directory_entry_property_mapping_418 WHERE _entry_id = e._entry_id)
) AS rawData
PIVOT
( MAX(_value)
FOR n IN (empty_property_list)
) AS pivottable
) AS details|NULL|1|1|2015-04-15 11:14:15.390|2015-04-15 11:14:15.420|1115,817|0,01859695|1115817|1115817|1115817|1115817|1107748|1107748|1107748|1107748|0|0|0|0|10051|10051|10051|10051|0|0|0|0|64|64|64|64|NULL|0x012F58F0645D8208|0xBEBA0EA95676B128|0x020000009CCDCE043C12EDAAE7A333C71AF128A51FB154790000000000000000000000000000000000000000|0x060016009CCDCE04B0DC38240400000001000000000000000000000000000000000000000000000000000000|<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.2" Build="12.0.2000.8"><BatchSequence><Batch><Statements><StmtSimple StatementText="(@0 int,@1 varchar(200),@searchParam0 nvarchar(4000))SET ARITHABORT ON; " StatementId="1" StatementCompId="1" StatementType="SET ON/OFF" RetrievedFromCache="true" /><StmtSimpleStatementText="DECLARE @propertiesToRea......... 

问题

除最后一个列以</ShowPlanXML...

开头外,所有列都被识别

enter image description here

我正在定义rowdelimiter和column delimiter,如下图所示:

enter image description here

我正在为每一行Tabstopp {t}{CR}{LF}使用这样的麦克风分隔符,但它也不起作用

0 个答案:

没有答案