Solved

bulk insert in ssis

Posted on 2011-03-12
3
505 Views
Last Modified: 2012-05-11
BULK INSERT [TestDB].[dbo].[TestTable] FROM 'C:\importedtxt' WITH(BATCHSIZE=1000,CODEPAGE='RAW',DATAFILETYPE='char',FIELDTERMINATOR='\t',ROWTERMINATOR='\n')


I'm running this via SSIS bulk insert component, my concern is with datafiletype=Char, so when I do bulk insert will it truncate any char long during bulk insert operation ? when I'm doing bcp, I'm also choose -c for data type but I'm not sure if when we bcp out the data will it cover all data which I have in the database, how about if I'm using widechar ? will it better ?
0
Comment
Question by:motioneye
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Aaron Shilo earned 500 total points
ID: 35121369
1. bcp will truncate the long char.
2. yes using widechar will minimize charecter loss if the source or dest are not unicode.
0
 

Author Comment

by:motioneye
ID: 35125700
So,
If I have following table structure, will using -N in bcp and "widenative"  during bulk insert is guarantee data will not get truncate ?

CREATE TABLE [dbo].[TestTable](
      [time] [datetime] NOT NULL,
      [eventid] [int] NOT NULL,
      [hostname] [varchar](255) NULL,
      [sessionid] [varchar](255) NULL,
      [username] [varchar](512) NULL,
      [agentname] [varchar](255) NULL,
      [realmname] [varchar](255) NULL,
      [realid] [varchar](64) NULL,
      [client] [varchar](255) NULL,
      [domainoid] [varchar](64) NULL,
      [authdirname] [varchar](255) NULL,
      [authdirserver] [varchar](512) NULL,
      [authdirnamespace] [varchar](255) NULL,
      [resource] [varchar](4096) NULL,
      [status] [varchar](1024) NULL,
      [reason] [int] NOT NULL,
      [transactionid] [varchar](255) NULL,
      [Name] [varchar](255) NULL,
      [computername] [varchar](512) NULL,
      [dirName] [varchar](255) NULL,
      [id] [int] IDENTITY(1,1) NOT NULL,
0
 

Author Closing Comment

by:motioneye
ID: 35186295
Tq
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question