Solved

bulk insert in ssis

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

791 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