unable to import data in sql server 2005

mmalik15
mmalik15 used Ask the Experts™
on
I am trying to import data into a sql server table
USE [bnf]
GO
/****** Object:  Table [dbo].[BNF63]    Script Date: 04/17/2012 17:32:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BNF63](
	[hrefid] [int] NOT NULL,
	[hrefparentid] [int] NULL,
	[some1] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
	[some2] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
	[type] [nvarchar](300) COLLATE Latin1_General_CI_AS NULL,
	[title] [nvarchar](500) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]

Open in new window

from a flat file but getting the follow errors

- Executing (Error)
Messages
Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column "Column 5" 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 "Column 5" (25)" failed because truncation occurred, and the truncation row disposition on "output column "Column 5" (25)" 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 "C:\Data\BNF63\March 2012\BNF_Hierarchy_v2_120308_BNF63.txt" on data row 23.
 (SQL Server Import and Export Wizard)
 
Error 0xc0047038: Data Flow Task: The PrimeOutput method on component "Source - BNF_Hierarchy_v2_120308_BNF63_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.
 (SQL Server Import and Export Wizard)
 
Error 0xc0047021: Data Flow Task: Thread "SourceThread0" has exited with error code 0xC0047038.
 (SQL Server Import and Export Wizard)
 
Error 0xc0047039: Data Flow Task: 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.
 (SQL Server Import and Export Wizard)
 
Error 0xc0047021: Data Flow Task: Thread "WorkThread0" has exited with error code 0xC0047039.
 (SQL Server Import and Export Wizard)
 

Open in new window

Any ideas what i m doing wrong
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Technology Development Consultant
Commented:
[some1] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[some2] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[type] [nvarchar](300) COLLATE Latin1_General_CI_AS NULL,
[title] [nvarchar](500) COLLATE Latin1_General_CI_AS NULL

one of your column having a data length greater in flat file than defined in table value try to increase column length you will get solution.

Regards,
nishant

Author

Commented:
i have changed the size of columns and the table looks like this
USE [bnf]
GO
/****** Object:  Table [dbo].[BNF63]    Script Date: 04/18/2012 10:59:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BNF63](
	[hrefid] [int] NOT NULL,
	[hrefparentid] [int] NULL,
	[some1] [nvarchar](4000) COLLATE Latin1_General_CI_AS NULL,
	[some2] [nvarchar](4000) COLLATE Latin1_General_CI_AS NULL,
	[type] [nvarchar](4000) COLLATE Latin1_General_CI_AS NULL,
	[title] [nvarchar](4000) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]

Open in new window



I'm still getting the same error. Also see attached my column mappings
column-mappings.png
nishant joshiTechnology Development Consultant

Commented:
why you are using size 50, use 4000 size column.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial