Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

I am trying to BCP Export/Import a large amount of data from one SQL Server 2008 R2 database to another which reside on the same server

$
0
0

I am trying to BCP Export/Import a large amount of data from one SQL Server 2008 R2 database to another which reside on the same server using Native format. The source is our live DB  which is populated from a website and the target is a reporting DB which we use for large data requests with flattened data tables.

The BCP does work if I use character data formats but the exported files are 10 times larger than the native formatted file and exceed 300GB and the execution time exceeds 8 hours. So this is not a viable solution.

I've been stuck on this for a few hours now and any help would be greatly appreciated

SELECT @@VERSION
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)   Apr  2 2010 15:48:46   Copyright (c) Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) 

HERE IS MY BCP OUT COMMAND

bcp live.dbo.ReturnAuthorizationsSummary out "E:\Microsoft SQL Server\DataTransfer\VW_ReturnAuthorizations.dat" -U user -P password -n

HERE IS MY BCP IN COMMAND 

bcp live.dbo.ReturnAuthorizationsSummary in "E:\Microsoft SQL Server\DataTransfer\VW_ReturnAuthorizations.dat" -U user -P password -n

HERE IS MY ERROR

NULL
Starting copy...
SQLState = 22008, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Invalid date format
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file
NULL
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1     
NULL

ALSO IF I TRY USING BULK IMPORT I GET A DIFFERENT ERROR

BULK INSERT ReturnAuthorizationsSummary 
    FROM 'E:\Microsoft SQL Server\DataTransfer\VW_ReturnAuthorizations.dat' 
   WITH (DATAFILETYPE='native');
GO

Msg 4863, Level 16, State 4, Line 1
Bulk load data conversion error (truncation) for row 1, column 2 (RequestDate).
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

HERE IS MY TARGET TABLE, I'VE DROPPED ALL INDEX AND KEYS FOR THE IMPORT. I HAVE A SCRIPT TO RECREATE THEM AFTER THE BCP

CREATE TABLE [dbo].[ReturnAuthorizationsSummary](
[ReturnAuthorizationNumber] [bigint] NOT NULL,
[RequestDate] [datetime] NULL,
[DebitMemoNumber] [nvarchar](40) NULL,
[DEANumber] [nchar](10) NULL,
[DEAExpirationDate] [datetime] NULL,
[EmailAddress] [nvarchar](50) NULL,
[Name] [nvarchar](50) NULL,
[Address1] [nvarchar](50) NULL,
[Address2] [nvarchar](50) NULL,
[City] [nvarchar](50) NULL,
[State] [char](2) NULL,
[ZipCode] [nchar](10) NULL,
[PhoneNumber] [nvarchar](50) NULL,
[ThirdPartyReverseDistributorProfileCode] [int] NULL,
[ThirdPartyReverseDistributorDEANumber] [nchar](10) NULL,
[RequestorFirstName] [nvarchar](50) NULL,
[RequestorLastName] [nvarchar](50) NULL,
[RequestorPhoneNumber] [nvarchar](50) NULL,
[RequestorEmailAddress] [nvarchar](50) NULL,
[RequestorFaxNumber] [nvarchar](50) NULL,
[PrimaryWholesalerProfileCode] [int] NULL,
[PrimaryWholesalerAccountNumber] [nvarchar](50) NULL,
[Status] [nvarchar](9) NULL,
[ProfileCode] [int] NULL,
[ManufacturerProfileCode] [int] NULL,
[ManufacturerComments] [nvarchar](max) NULL,
[SourceOfEntry] [nvarchar](20) NULL,
[CreatedBy] [nvarchar](20) NULL,
[ApprovedDate] [datetime] NULL,
[ApprovedBy] [nvarchar](20) NULL,
[StatusLastChangeDate] [datetime] NULL,
[ReturnAuthorizationNumberControl2] [bigint] NULL,
[ProcessedItemCount] [bigint] NULL,
[IndirectAccountProfileCode] [int] NULL,
[ReceivedStatusDate] [datetime] NULL,
[PreIndStatusDate] [datetime] NULL,
[FinalIndStatusDate] [datetime] NULL,
[FinalSortStatusDate] [datetime] NULL,
[PreShipStatusDate] [datetime] NULL,
[ClosedStatusDate] [datetime] NULL,
[ExpiredStatusDate] [datetime] NULL,
[PartialsEntryMethod] [char](1) NULL,
[DestroyedbyRequestor] [bit] NULL,
[CreditIssuedDate] [datetime] NULL,
[FirstBoxReceivedDate] [datetime] NULL,
[ProfileName] [nvarchar](50) NULL,
[ProfileDEANumber] [nchar](10) NULL,
[ProfileDEAExpirationDate] [datetime] NULL,
[ThirdPartyReverseDistributorProfileName] [nvarchar](50) NULL,
[ThirdPartyReverseDistributorProfileDEANumber] [nchar](10) NULL,
[ThirdPartyReverseDistributorProfileDEAExpirationDate] [datetime] NULL,
[PrimaryWholesalerProfileName] [nvarchar](50) NULL,
[PrimaryWholesalerProfileDEANumber] [nchar](10) NULL,
[PrimaryWholesalerProfileDEAExpirationDate] [datetime] NULL,
[ManufacturerProfileName] [nvarchar](50) NULL,
[ManufacturerProfileDEANumber] [nchar](10) NULL,
[ManufacturerProfileDEAExpirationDate] [datetime] NULL,
[ManufacturerProfileSalesOrg] [nvarchar](20) NULL,
[IndirectAccountNumber] [nvarchar](15) NULL,
[ReturnAuthorizationDescription] [nvarchar](130) NULL,
[ShippingAndHandling] [decimal](38, 2) NULL,
[ExternalInterfaceDate] [datetime] NULL,
[DebitMemoReturnValueTotal] [decimal](38, 2) NULL,
[ReturnAuthorizationsItemsReturnValueTotal] [decimal](38, 2) NULL,
[ReturnableItemLowestPriceValueTotal] [decimal](38, 2) NULL,
[ReturnableItemValueTotal] [decimal](38, 2) NULL,
[ForceExternalInterface] [bit] NULL,
[ReturnAuthorizationType] [nvarchar](10) NULL,
[ExternalReturnAuthorizationNumber] [nvarchar](50) NULL
) ON [PRIMARY]


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>