Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 bcp -> bulk insert

Author  Topic 

Becio
Starting Member

4 Posts

Posted - 2007-12-11 : 06:38:17
hi all, I have a small problem, I want to export my data from an instance of sqlserver(8.0) and importing it to another instance, so I used this command:

@bcp "select * from [MYTABLE] order by id" queryout "export.dat" -T -N

then to import the data in the new sqlserver instance, I use this TSQL:

BULK INSERT [MYTABLE]
FROM 'export.dat'
WITH (KEEPNULLS, DATAFILETYPE='widenative')

but I get these errors:

Server: Msg 4866, Level 17, State 66, Line 1
Server: Msg 7399, Level 16, State 1, Line 1

in my scenario I must use BULK INSERT to import data, so I don't have alternatives. The weird thing is that this procedure works well for most of my tables, I get that error only for two of them.

I included the script for one of them, in case anyone could give me any hint to solve this problem. thanks.


CREATE TABLE [dbo].[Domain_EntityBase] (
[Id] [int] NOT NULL ,
[IdParent] [int] NULL ,
[Label] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[PluralLabel] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[Description] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
[ClassName] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
[IdAction] [int] NULL ,
[HasAttributes] [bit] NULL ,
[HasDocument] [bit] NULL ,
[IsVisible] [bit] NULL ,
[ManageModuleName] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[ViewModuleName] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[FlagSegmentation] [int] NULL ,
[CreateUser] [int] NULL ,
[UpdateUser] [int] NULL ,
[CreateTimestamp] [datetime] NULL ,
[UpdateTimestamp] [datetime] NULL ,
[Guid] [uniqueidentifier] NULL ,
[RowVersion] [int] NULL
) ON [PRIMARY]

Becio
Starting Member

4 Posts

Posted - 2007-12-11 : 06:54:59
maybe a different column order between the importing table and the exporting table can cause that error?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-12-11 : 08:12:51
see if this helps:
http://support.microsoft.com/kb/324122

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page
   

- Advertisement -