2012年2月25日星期六

BCP between two different servers

How would you go about bcp two tables from 2000 on server a and bcping it to
6.5 on server b?
New SQL Server DBA
BCP (OUT) to a file - BCP (IN) to the table on 6.5 See BCP in the SQL BOL
for more info on the syntax or run BCP /? from a CMD prompt.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA
|||Hi,
If both the servers are accessible in network then go for DTS from SQL 2000
machine.
Select Source as SQL 2000 and destination as SQL 6.5 in DTS.
If both the servers are not accessible each other then:-
1. BCP OUT from SQL 2000 (See to that all the data column width matches. Eg:
SQL 6.5 Varchar and Char only support 255 characters).
2. BCP IN into SQL 6.5
Thanks
hari
SQL Server MVP
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA

BCP between two different servers

How would you go about bcp two tables from 2000 on server a and bcping it to
6.5 on server b?
--
New SQL Server DBABCP (OUT) to a file - BCP (IN) to the table on 6.5 See BCP in the SQL BOL
for more info on the syntax or run BCP /? from a CMD prompt.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA|||Hi,
If both the servers are accessible in network then go for DTS from SQL 2000
machine.
Select Source as SQL 2000 and destination as SQL 6.5 in DTS.
If both the servers are not accessible each other then:-
1. BCP OUT from SQL 2000 (See to that all the data column width matches. Eg:
SQL 6.5 Varchar and Char only support 255 characters).
2. BCP IN into SQL 6.5
Thanks
hari
SQL Server MVP
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA

BCP between two different servers

How would you go about bcp two tables from 2000 on server a and bcping it to
6.5 on server b?
--
New SQL Server DBABCP (OUT) to a file - BCP (IN) to the table on 6.5 See BCP in the SQL BOL
for more info on the syntax or run BCP /? from a CMD prompt.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA|||Hi,
If both the servers are accessible in network then go for DTS from SQL 2000
machine.
Select Source as SQL 2000 and destination as SQL 6.5 in DTS.
If both the servers are not accessible each other then:-
1. BCP OUT from SQL 2000 (See to that all the data column width matches. Eg:
SQL 6.5 Varchar and Char only support 255 characters).
2. BCP IN into SQL 6.5
Thanks
hari
SQL Server MVP
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:05E71CDA-B47C-4543-90E1-83EA6E084F3F@.microsoft.com...
> How would you go about bcp two tables from 2000 on server a and bcping it
> to
> 6.5 on server b?
> --
> New SQL Server DBA

BCP Beginner - Please Help

Hi,

I am completely new to the BCP utility and fairly new to SQL Server

I am learning from a book and I am trying the following example (the server
I'm learning on is called contractor and a password has not been give to the
sa)

bcp pubs..authors out authors.txt -C -r \n -t, -U sa -P -S contractor

When I run this in Query Analyser i get the error message..

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '.'.

I have tried puuting quotes around the database and the table name as
follows-

bcp "pubs..authors" out authors.txt -C -r \n -t, -U sa -P -S contractor

and get the error

Server: Msg 179, Level 15, State 1, Line 1
Cannot use the OUTPUT option when passing a constant to a stored procedure.

Please can anybody help me to get this first bit working?

Thanks in anticipation.In your bcp statement, is the -C supposed to indicate that it is a
character file? If so, it needs to be lowercase (-c), otherwise it
indicates the code page, which expects a value. Also, I don't know if
this makes a difference, but I've never used spaces between the options
and the values (for example, -Usa instead of -U sa). I thought I
remembered both working, but in the help I didn't see anything about
the space being allowed and the samples given do not have spaces.

HTH,
-Tom.|||Stevie D (Steve@.127.0.0.1) writes:
> I am completely new to the BCP utility and fairly new to SQL Server
> I am learning from a book and I am trying the following example (the
> server I'm learning on is called contractor and a password has not been
> give to the sa)
> bcp pubs..authors out authors.txt -C -r \n -t, -U sa -P -S contractor
> When I run this in Query Analyser i get the error message..

You don't BCP from Query Analyzer. You run it from a command-line
window.

And, as Thomas pointed out, you should use -c and not -C. The
spacing should be OK, though.

> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near '.'.

(The reason you get this syntax error is that bcp is not an SQL
command. Everything that is an identifier, but not a command is
taken as a stored procedure command. Next token is pubs. When calling
stored procedures quotes around strings that follow identifier syntax
are optional. (This is to permit us to write "sp_help tbl", instead
of "EXEC sp_help 'tbl'".) When the dot comes there is no longer
any saver.)

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

BCP bcp is not recognized

Hi
I am a bit new to SQL Server so please help me
I am trying to run a simple task at a customer but it doesn't work.
bcp isn't recognized.

I'm running this:
exec xp_cmdshell 'bcp "SELECT top 10 * FROM pubs..authors " queryout "C:\Temp\hej.txt" -c -S [ServerName] -T'
and it givs me this errormess.
'bcp' is not recognized as an internal or external command,

It works fine for me when I'm running it on my computer.

Can anyone please inform me what I'm missing. I haven't got a clue.
BR
CiottiIs the folder where bcp.exe is in your path (system) ?|||Hai ciotti,

Where is the "hej.txt" file located ? In the server hard disk or in the client machine hard disk.

When u use xp_cmdshell extended stored procdure, the command will be executed in the server and not in the client machine.

You have said that it works fine in ur system. So did u executed 'bcp' from the command line or using xp_cmdshell ?

If ur machine is the server and u executed it in the command prompt, then fine, u have to include the path of "bcp" in the System PATH.

Hope this helps u...Do let us know what happened.|||You were right. Someone had messed up the system path.
(Don't know who, and I dont care ;) )

Now the bcp command works.
The customer is happy and that makes me happy.
Thank you all for your quick answers.

/Ciotti

2012年2月23日星期四

bcp batch file

created a batch file to bcp info out of tables. When executing the file it
just loops on the first bcp statement without executing. The odd thing is I
can't execute the bcp from the command line on the c: drive, but it will
execute from a network drive prompt. Have full rights to the server. Here's
the statement. Have also tried with sql login.
bcp Database.dbo.table out d:\bcp\table.bcp -n -T
Please post the error which you are getting.
"cheilig" wrote:

> created a batch file to bcp info out of tables. When executing the file it
> just loops on the first bcp statement without executing. The odd thing is I
> can't execute the bcp from the command line on the c: drive, but it will
> execute from a network drive prompt. Have full rights to the server. Here's
> the statement. Have also tried with sql login.
> bcp Database.dbo.table out d:\bcp\table.bcp -n -T

bcp batch file

created a batch file to bcp info out of tables. When executing the file it
just loops on the first bcp statement without executing. The odd thing is I
can't execute the bcp from the command line on the c: drive, but it will
execute from a network drive prompt. Have full rights to the server. Here's
the statement. Have also tried with sql login.
bcp Database.dbo.table out d:\bcp\table.bcp -n -TPlease post the error which you are getting.
"cheilig" wrote:

> created a batch file to bcp info out of tables. When executing the file it
> just loops on the first bcp statement without executing. The odd thing is
I
> can't execute the bcp from the command line on the c: drive, but it will
> execute from a network drive prompt. Have full rights to the server. Here'
s
> the statement. Have also tried with sql login.
> bcp Database.dbo.table out d:\bcp\table.bcp -n -T