我想把一个文本文档导入到数据库中,以下是文本文档的格式:
08/07/08 16:23:29 GeneralMoney: chen, 4, 122, 2, 192.168.2.22, 192.168.1.82, 交换, 项目ID=64587,金额=50
08/07/08 16:23:31 GeneralMoney: han, 4, 122, 2000, 192.168.2.27, 192.168.1.82, 交换, 项目ID=47852,金额=20000想导入到数据库中后为12列,分别为:A          B          C              D     E    F     G     H              I             J     K             L 
08/07/08   16:23:29   GeneralMoney   chen   4   122   2     192.168.2.22   192.168.1.82  交换   项目ID=64587   金额=50
08/07/08   16:23:31   GeneralMoney   han    4   122   2000  192.168.2.27   192.168.1.82  交换   项目ID=47852   金额=20000请问应该怎么操作?

解决方案 »

  1.   

    先导入一个表(九列),然后把处理了第一行的数据到另一个表(12列)
    insert into table(字段) select 字段1的一部分,字段1的第二部分,字段1的第三部分,字段1的第四部分,其它字段
    select left(字段1,charindex(' ',字段1)......
      

  2.   

    SQL2000的话,建个12列的表,使用数据倒入功能,可以直接往里面导
      

  3.   

    使用insert语句。或者格式化一下数据,使用数据库导入/导出程序。
      

  4.   


    create table [tablename] (
      A varchar(64),
      B varchar(64),
      C varchar(64),
      D varchar(64),
      E varchar(64),
      F varchar(64),
      G varchar(64),
      H varchar(64),
      I varchar(64),
      J varchar(64),
      K varchar(64),
      L varchar(64)
    )
    go
    BULK INSERT [tablename]
       FROM 'filename'
       WITH 
          (
     FIRSTROW = 1,
             FIELDTERMINATOR = '\t', -- or ' '
             ROWTERMINATOR = '\n'
          )
    go
      

  5.   

    Operation stopped...- Initializing Data Flow Task (Success)- Initializing Connections (Success)- Setting SQL Command (Success)- Setting Source Connection (Success)- Setting Destination Connection (Success)- Validating (Warning)
    Messages
    Warning 0x80047076: Data Flow Task: The output column " 0天->80天" (10) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     
    Warning 0x80047076: Data Flow Task: The output column " 300" (14) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     
    Warning 0x80047076: Data Flow Task: The output column " 219 149 11 15" (18) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     
    Warning 0x80047076: Data Flow Task: The output column " 0天->80天" (10) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     
    Warning 0x80047076: Data Flow Task: The output column " 300" (14) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     
    Warning 0x80047076: Data Flow Task: The output column " 219 149 11 15" (18) on output "Flat File Source Output" (2) and component "Source - Money0808_txt" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
     (SQL Server Import and Export Wizard)
     - Prepare for Execute (Success)- Pre-execute (Success)
    Messages
    Information 0x402090dc: Data Flow Task: The processing of file "D:\Money0808.txt" has started.
     (SQL Server Import and Export Wizard)
     - Executing (Error)
    Messages
    Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column " 0天->80天" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
     (SQL Server Import and Export Wizard)
     
    Error 0xc020902a: Data Flow Task: The "output column " 0天->80天" (10)" failed because truncation occurred, and the truncation row disposition on "output column " 0天->80天" (10)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
     (SQL Server Import and Export Wizard)
     
    Error 0xc0202092: Data Flow Task: An error occurred while processing file "D:\Money0808.txt" on data row 3.
     (SQL Server Import and Export Wizard)
     
    Error 0xc0047038: Data Flow Task: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Source - Money0808_txt" (1) returned error code 0xC0202092.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
     (SQL Server Import and Export Wizard)
     
    Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED.  Thread "SourceThread0" has exited with error code 0xC0047038.  There may be error messages posted before this with more information on why the thread has exited.
     (SQL Server Import and Export Wizard)
     
    Error 0xc0047039: Data Flow Task: SSIS Error Code DTS_E_THREADCANCELLED.  Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.  There may be error messages posted before this with more information on why the thread was cancelled.
     (SQL Server Import and Export Wizard)
     
    Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED.  Thread "WorkThread0" has exited with error code 0xC0047039.  There may be error messages posted before this with more information on why the thread has exited.
     (SQL Server Import and Export Wizard)
     - Copying to [test].[dbo].[Money0808] (Stopped)- Post-execute (Success)
    Messages
    Information 0x402090dd: Data Flow Task: The processing of file "D:\Money0808.txt" has ended.
     (SQL Server Import and Export Wizard)
     
    Information 0x402090df: Data Flow Task: The final commit for the data insertion has started.
     (SQL Server Import and Export Wizard)
     
    Information 0x402090e0: Data Flow Task: The final commit for the data insertion has ended.
     (SQL Server Import and Export Wizard)
     - Cleanup (Success)
    Messages
    Information 0x4004300b: Data Flow Task: "component "Destination - Money0808" (74)" wrote 0 rows.
     (SQL Server Import and Export Wizard)
     上面是导入时产生的错误日志,请帮忙看看什么原因
      

  6.   

    - Executing (Error) 
    Messages 
    Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column " 0天->80天" returned status value 4 and status text "
    Text was truncated or one or more characters had no match in the target code page.". 
    (SQL Server Import and Export Wizard)