Friday, February 24, 2012

BULK INSERT

hello,
i want to import a flat file in the sql server.
Is it possible that when setting up the bulk insert command
example
BULK INSERT TFB_EasyCashCustomerFTemp FROM 'e:\mycustomer.csv'
WITH
(
FIELDTERMINATOR = ';',
ROWTERMINATOR = '|\n'
)
also a table with the number of fields shoud be created (the name should be
for example mycustomer)?
If this table exists - all works ok!
All fields in the table could be of type varchar(50).The table has more then
80 fields.
thanks
is it possible that the bulk insert command>> .. also a table with the number of fields shoud be created
Without knowing the structure of the file, you cannot do that.
Of course you can create a staging table and do the BULK INSERT and move it
to the destination table which has got the right constraints and keys to
prevent data corruption.
Anith|||thanks Anith
"Anith Sen" wrote:

> Without knowing the structure of the file, you cannot do that.
>
> Of course you can create a staging table and do the BULK INSERT and move i
t
> to the destination table which has got the right constraints and keys to
> prevent data corruption.
> --
> Anith
>
>

No comments:

Post a Comment