Hi,
Is it possible to do a bulk insert from one table to another with field
delimiter?
Example:
I have records in table A that means to be parsed into table B:
Table A
LineFeed Varchar(8000)
Table B
Customer_Number char(8)
First_Name varchar(25)
Last_name varchar(25)
DOB Timedate
The records in table A look like this..
1234567;Kevin;Smith;10/25/2005
123458;Eric;Joe M;11/10/2004
I know how to do this with a cursor and parsing the field by using charindex
and stuff, but i wonder if there's a faster way of doing it with a simple BC
P
utility.Yes, although it's a bit tricky, and the format file is a bit unforgiving
and error messages are cryptic.. You should check out previous posts in this
forum on Bulk Insert" (and Books OnLine as well)
"EricH" wrote:
> Hi,
> Is it possible to do a bulk insert from one table to another with field
> delimiter?
> Example:
> I have records in table A that means to be parsed into table B:
> Table A
> LineFeed Varchar(8000)
> Table B
> Customer_Number char(8)
> First_Name varchar(25)
> Last_name varchar(25)
> DOB Timedate
> The records in table A look like this..
> 1234567;Kevin;Smith;10/25/2005
> 123458;Eric;Joe M;11/10/2004
> I know how to do this with a cursor and parsing the field by using charind
ex
> and stuff, but i wonder if there's a faster way of doing it with a simple
BCP
> utility.|||Hi CBretana,
I've tried reading books online and it don't talk about moving data from one
table to another.
I have tried the following syntax and it's coming back as an error:
BULK INSERT tempdb.dbo.TableA
FROM (SELECT Linefeed from tempdb.dbo.TableB) S
WITH
(FIELDTERMINATOR = ';')
Anyone else seeing a problem here?|||Because Bulk Insert is for moving Data from EXTERNAL files into Sql Server,
not for moving data from One table to another. For this latter purpose you
should use standard SQL Insert/Update Statements, or DTS.
"EricH" wrote:
> Hi CBretana,
> I've tried reading books online and it don't talk about moving data from o
ne
> table to another.
> I have tried the following syntax and it's coming back as an error:
> BULK INSERT tempdb.dbo.TableA
> FROM (SELECT Linefeed from tempdb.dbo.TableB) S
> WITH
> (FIELDTERMINATOR = ';')
> Anyone else seeing a problem here?
>
No comments:
Post a Comment