SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BCP Error with datetime columns


BCP Error with datetime columns

Author
Message
pogla.the.grate
pogla.the.grate
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 88
Sorry, I just realised this was under Server 2000. Re-posted under 2005.


Hi all,
I have tried searching but cannot find a specific answer to my problem.

I am using BCP with a native file format (-n not using -N) to extract data for a delta load.

Using the main database, this works fine. The problem comes about when I have to pull data directly from a source database.

The source database is a clone of a SIEBEL database put onto a SQL Server 2005 instance.

The problem is, I belive, an issue with the date format in the extract file.

BCP statement:
BCP "Select * FROM [SIEBEL_SOURCE_INSTANCE].[SIEBEL_SOURCE_DB].[SOURCE_TABLE]
WHERE LAST_UPD BETWEEN (DATE) AND (DATE)" queryout [FileName] -n -q -S[LocalServer] -T >[LogFile]


When I try to import into a table using bulk insert (for testing- this will happen in the final product) Bulk insert statement:
BULK INSERT [database].dbo.[Table_Name]
FROM '[sourceFile]';
WITH (
KEEPNULLS,
DATAFILETYPE = 'native',
)


I get an error:
Msg 4863, Level 16, State 4, Line 1
Bulk load data conversion error (truncation) for row1, column 2 (Created_Date).
...


I have tride changing the datetime columns to char(500) data types, and I get the following error message:
Msg 4866, Level 16, State 7, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 2. Verify that the field terminator and row terminator are specified correctly
...


When I use a unicode BCP statement (with a -w switch) with nominated field and row terminators, the table loads fine.

There is, however, a requirement to use the native file formats for the final product.

SQL Server 2005 service pack 3

Source database is a Clone of SIEBEL 7 stored on a SQL Server 2005 database.
FMTONLY
FMTONLY
SSC Veteran
SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)

Group: General Forum Members
Points: 291 Visits: 282
Hi All,

Even i am also facing the same problem, Any quick response is helpfull.

Thank you,:-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search