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
 General SQL Server Forums
 New to SQL Server Programming
 BCP problem

Author  Topic 

kidaduo
Starting Member

45 Posts

Posted - 2008-01-11 : 08:53:18
Hellow,

I'm new in PCP utilities-- I hope someone will help me. I need to export data from SQL 2000 into my c drive.
-----------------------------------------
script:

bcp MYDATABASE.dbo.TUDATA OUT[C : / TUDATA.TXT] - S MYSERVERNAME - U %USA % - P % 123% - W - T

------------------------------------
ERROR:
LINE 1: Incorrect syntax near '.'.

Thank u

Josephine

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-11 : 09:03:40
bcp "MYDATABASE.dbo.TUDATA" OUT "C:/TUDATA.TXT" -S "MYSERVERNAME" -U "USA" -P "123" -W -T


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-01-11 : 09:09:16
Thank you Harsh,

Your suggestion produce the following error:

"CANNOT US THE OUTPUT OPTION WHEN PASSING A CONSTANT TO A STORED PROCEDURE"

Any idea?????

Thk

quote:
Originally posted by harsh_athalye

bcp "MYDATABASE.dbo.TUDATA" OUT "C:/TUDATA.TXT" -S "MYSERVERNAME" -U "USA" -P "123" -W -T


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"



Josephine
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-11 : 09:14:00
Is TUDATA a stored procedure?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-01-11 : 09:20:07

Harsh,

TUDATA is a table. I'm running using qry analyzer-- may be I'm running from the wrong araea.

Thk


quote:
Originally posted by harsh_athalye

Is TUDATA a stored procedure?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"



Josephine
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-01-11 : 09:21:35
Looks like you are executing this as a query.
It's a command line utility

master..xp_cmdhell bcp "MYDATABASE.dbo.TUDATA" OUT "C:/TUDATA.TXT" -S "MYSERVERNAME" -U "USA" -P "123" -W -T'

But c: would be ion the server.

Put the command in a .bat file or run it in a cmd window on your machine.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-01-11 : 09:26:54
NR,
I change to reflect your suggestion and is working without any issue. Thank you both of you Harsh and NR for your help.

quote:
Originally posted by nr

Looks like you are executing this as a query.
It's a command line utility

master..xp_cmdhell bcp "MYDATABASE.dbo.TUDATA" OUT "C:/TUDATA.TXT" -S "MYSERVERNAME" -U "USA" -P "123" -W -T'

But c: would be ion the server.

Put the command in a .bat file or run it in a cmd window on your machine.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.



Josephine
Go to Top of Page
   

- Advertisement -