dbTalk Databases Forums  

Bcp import - how?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Bcp import - how? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Adam Boczek
 
Posts: n/a

Default Bcp import - how? - 06-02-2004 , 02:15 AM






I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination of
parameters (-q etc.), but the result ist always wrong (that means, I've
imported but fields are filled with no or partial data). Where can I find a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------



Reply With Quote
  #2  
Old   
Hari
 
Posts: n/a

Default Re: Bcp import - how? - 06-02-2004 , 02:25 AM






Hi,

Use BULK Insert.

1. I have saved the contents as ccc.txt in drive.

2. Created a table with below script :-

create table zz(id uniqueidentifier,name varchar(30),calories int)

3. Executed the below in query analyzer

BULK INSERT master.dbo.zz
FROM 'c:\ccc.txt'
WITH
(
FIELDTERMINATOR = ','
)

4. select * from zz

id name calories
------------------------------------ ------------------------------ --------
---
F5F781EF-4270-4D8C-B5E0-A968F45FF771 "Ananas frisch" 60
CA0E96D8-9017-4DDD-BF29-B78D3DC8180D "Ananas Fruchtnektar" 70
A1777D54-9303-4AF5-A721-250A39BA731C "Ananas Fruchtsaft" 60
DACC2063-0985-41EB-9A33-B4D8A10F1C79 "Ananas getrocknet" 300
04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3 "Ananas kandiert" 250

(5 row(s) affected)

Thanks
Hari
MCDBA

"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote

Quote:
I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination of
parameters (-q etc.), but the result ist always wrong (that means, I've
imported but fields are filled with no or partial data). Where can I find
a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------





Reply With Quote
  #3  
Old   
Adam Boczek
 
Posts: n/a

Default Re: Bcp import - how? - question is still open - 06-02-2004 , 02:58 AM



Thanx, that works! But the question is still open, how to do it using bcp

Thanx
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Hari" <hari_prasad_k (AT) hotmail (DOT) com> schrieb im Newsbeitrag
news:uL0jbLHSEHA.380 (AT) tk2msftngp13 (DOT) phx.gbl...
Quote:
Hi,

Use BULK Insert.

1. I have saved the contents as ccc.txt in drive.

2. Created a table with below script :-

create table zz(id uniqueidentifier,name varchar(30),calories int)

3. Executed the below in query analyzer

BULK INSERT master.dbo.zz
FROM 'c:\ccc.txt'
WITH
(
FIELDTERMINATOR = ','
)

4. select * from zz

id name
calories
------------------------------------ ------------------------------ ------
--
---
F5F781EF-4270-4D8C-B5E0-A968F45FF771 "Ananas frisch" 60
CA0E96D8-9017-4DDD-BF29-B78D3DC8180D "Ananas Fruchtnektar" 70
A1777D54-9303-4AF5-A721-250A39BA731C "Ananas Fruchtsaft" 60
DACC2063-0985-41EB-9A33-B4D8A10F1C79 "Ananas getrocknet" 300
04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3 "Ananas kandiert" 250

(5 row(s) affected)

Thanks
Hari
MCDBA

"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in message
news:1086160529.62750 (AT) proxy (DOT) ham.cs-consulting.de...
I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination of
parameters (-q etc.), but the result ist always wrong (that means, I've
imported but fields are filled with no or partial data). Where can I
find
a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------







Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Bcp import - how? - question is still open - 06-02-2004 , 03:19 AM



This seems to work for me

C:\>bcp tempdb.dbo.zz in c:\Document.txt -t, -T -S(local) -c -F2



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote

Quote:
Thanx, that works! But the question is still open, how to do it using bcp


Thanx
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Hari" <hari_prasad_k (AT) hotmail (DOT) com> schrieb im Newsbeitrag
news:uL0jbLHSEHA.380 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi,

Use BULK Insert.

1. I have saved the contents as ccc.txt in drive.

2. Created a table with below script :-

create table zz(id uniqueidentifier,name varchar(30),calories int)

3. Executed the below in query analyzer

BULK INSERT master.dbo.zz
FROM 'c:\ccc.txt'
WITH
(
FIELDTERMINATOR = ','
)

4. select * from zz

id name
calories

------------------------------------ ------------------------------ ------
--
---
F5F781EF-4270-4D8C-B5E0-A968F45FF771 "Ananas frisch" 60
CA0E96D8-9017-4DDD-BF29-B78D3DC8180D "Ananas Fruchtnektar" 70
A1777D54-9303-4AF5-A721-250A39BA731C "Ananas Fruchtsaft" 60
DACC2063-0985-41EB-9A33-B4D8A10F1C79 "Ananas getrocknet" 300
04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3 "Ananas kandiert" 250

(5 row(s) affected)

Thanks
Hari
MCDBA

"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in message
news:1086160529.62750 (AT) proxy (DOT) ham.cs-consulting.de...
I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination of
parameters (-q etc.), but the result ist always wrong (that means,
I've
imported but fields are filled with no or partial data). Where can I
find
a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------









Reply With Quote
  #5  
Old   
Adam Boczek
 
Posts: n/a

Default Re: Bcp import - how? - question is still open - 06-02-2004 , 04:10 AM



Wow, that's it! "-c" and also "-C" for german special signs.

Thanx,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> schrieb im Newsbeitrag
news:ecRIrpHSEHA.2876 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Quote:
This seems to work for me

C:\>bcp tempdb.dbo.zz in c:\Document.txt -t, -T -S(local) -c -F2



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in message
news:1086163109.696219 (AT) proxy (DOT) ham.cs-consulting.de...
Thanx, that works! But the question is still open, how to do it using
bcp


Thanx
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Hari" <hari_prasad_k (AT) hotmail (DOT) com> schrieb im Newsbeitrag
news:uL0jbLHSEHA.380 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi,

Use BULK Insert.

1. I have saved the contents as ccc.txt in drive.

2. Created a table with below script :-

create table zz(id uniqueidentifier,name varchar(30),calories int)

3. Executed the below in query analyzer

BULK INSERT master.dbo.zz
FROM 'c:\ccc.txt'
WITH
(
FIELDTERMINATOR = ','
)

4. select * from zz

id name
calories


------------------------------------ ------------------------------ ------
--
---
F5F781EF-4270-4D8C-B5E0-A968F45FF771 "Ananas frisch" 60
CA0E96D8-9017-4DDD-BF29-B78D3DC8180D "Ananas Fruchtnektar" 70
A1777D54-9303-4AF5-A721-250A39BA731C "Ananas Fruchtsaft" 60
DACC2063-0985-41EB-9A33-B4D8A10F1C79 "Ananas getrocknet"
300
04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3 "Ananas kandiert"
250

(5 row(s) affected)

Thanks
Hari
MCDBA

"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in message
news:1086160529.62750 (AT) proxy (DOT) ham.cs-consulting.de...
I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination of
parameters (-q etc.), but the result ist always wrong (that means,
I've
imported but fields are filled with no or partial data). Where can I
find
a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------











Reply With Quote
  #6  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Bcp import - how? - question is still open - 06-02-2004 , 04:21 AM



ich hatte keine spezielle Deutsche Anzeichen :-)

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote

Quote:
Wow, that's it! "-c" and also "-C" for german special signs.

Thanx,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> schrieb im Newsbeitrag
news:ecRIrpHSEHA.2876 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
This seems to work for me

C:\>bcp tempdb.dbo.zz in c:\Document.txt -t, -T -S(local) -c -F2



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in message
news:1086163109.696219 (AT) proxy (DOT) ham.cs-consulting.de...
Thanx, that works! But the question is still open, how to do it using
bcp


Thanx
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------
"Hari" <hari_prasad_k (AT) hotmail (DOT) com> schrieb im Newsbeitrag
news:uL0jbLHSEHA.380 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi,

Use BULK Insert.

1. I have saved the contents as ccc.txt in drive.

2. Created a table with below script :-

create table zz(id uniqueidentifier,name varchar(30),calories int)

3. Executed the below in query analyzer

BULK INSERT master.dbo.zz
FROM 'c:\ccc.txt'
WITH
(
FIELDTERMINATOR = ','
)

4. select * from zz

id name
calories



------------------------------------ ------------------------------ ------
--
---
F5F781EF-4270-4D8C-B5E0-A968F45FF771 "Ananas frisch"
60
CA0E96D8-9017-4DDD-BF29-B78D3DC8180D "Ananas Fruchtnektar"
70
A1777D54-9303-4AF5-A721-250A39BA731C "Ananas Fruchtsaft"
60
DACC2063-0985-41EB-9A33-B4D8A10F1C79 "Ananas getrocknet"
300
04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3 "Ananas kandiert"
250

(5 row(s) affected)

Thanks
Hari
MCDBA

"Adam Boczek" <adam.boczek (AT) NO_SPAM (DOT) cs-consulting.de> wrote in
message
news:1086160529.62750 (AT) proxy (DOT) ham.cs-consulting.de...
I've exported one table using DTS to *.txt file:

"id","name","calories"
{F5F781EF-4270-4D8C-B5E0-A968F45FF771},"Ananas frisch",60
{CA0E96D8-9017-4DDD-BF29-B78D3DC8180D},"Ananas Fruchtnektar",70
{A1777D54-9303-4AF5-A721-250A39BA731C},"Ananas Fruchtsaft",60
{DACC2063-0985-41EB-9A33-B4D8A10F1C79},"Ananas getrocknet",300
{04E462EC-57B1-4882-A8DF-A1EFC1B9C4F3},"Ananas kandiert",250

How can I import this data using bcp? I've tried many combination
of
parameters (-q etc.), but the result ist always wrong (that means,
I've
imported but fields are filled with no or partial data). Where can
I
find
a
good description of bcp utility with examples (msdn is very poor)?

Thanx in advance,
Adam

--
----------------------------------------------------
Adam Boczek
adam.boczek (AT) cs-consulting (DOT) de
----------------------------------------------------













Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.