Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Batch Insert - newbie stuff
Message
De
24/08/2006 11:23:47
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Import/Export
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01148018
Message ID:
01148242
Vues:
15
Thanks again Sergey, you are a life saver!

Glenn

>Glenn,
>
>The text file doesn't have prefix for text field so it should be 0 in .FMT file. The following works
>-- .FMT
>8.0
>2
>1	SQLCHAR	0	18	"\t"	1	sku1	SQL_Latin1_General_CP1_CI_AS
>2	SQLCHAR	0	0	"\r\n"	2	biblio	SQL_Latin1_General_CP1_CI_AS
>-- .SQL
>bulk insert dbo.Annotation from 'H:\TMP\bcp\test.txt'
>WITH (
>	fORMATFILE = 'H:\TMP\bcp\ANNOTATIONS.FMT'
>  )
>
>>This is my first attempt at using either BCP or Batch Insert. Can someone point me in the right direction?
>>
>>My text file looks like this
>>xxxxxxxxxx/t:xxx...xxx/n: (yes tab and newline not literal /t:)
>>
>>my SQL table looks like
>>sku1 char 18 not null
>>biblio Text not null
>>fname Char 25 not null
>>UID int identity not null
>>
>>my format file looks like:
>>8.0
>>2
>>1 SQLCHAR 0 18 "/t:" 1 sku1 SQL_Latin1_General_CP1_CI_AS
>>2 SQLCHAR 4 0 "/t:/n:" 2 biblio SQL_Latin1_General_CP1_CI_AS
>>
>>my command looks like:
>>bulk insert dbo.Annotation from 'd:\TEMP\annotations.txt'
>>WITH (
>> DATAFILETYPE = 'char',
>> fORMATFILE = 'D:\TEMP\ANNOTATIONS.FMT'
>> )
>>
>>my error looks like:
>>Server: Msg 4866, Level 17, State 66, Line 1
>>Bulk Insert fails. Column is too long in the data file for row 1, column 1. Make sure the field terminator and row terminator are specified correctly.
>>Server: Msg 7399, Level 16, State 1, Line 1
>>OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.
>>The statement has been terminated.
>>
>>
>>
>>Thanks
>>
>>Glenn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform