Solved

bulk insert in ssis

Posted on 2011-03-12
3
501 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now