SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BCP Error On New Server


BCP Error On New Server

Author
Message
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
Okay, don't know how many ways I can say it. It looks like you need to add the -S parameter to your BCP command line. Without it BCP is trying to connect to the default instance of SQL Server and you have specified that you are using a named instance on the new server. This means you need to tell bcp the name of the instance.

This:



SELECT @sMysql = 'bcp "SELECT sOutput FROM MYDATABASE.dbo.VPOSITIVEPAY" queryout ' + @sFilePath + @sFileName + ' -S [SQLSVR04\SS2005] -T -c'




Notice the -S parameter I have added.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
YSLGuru
YSLGuru
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1846 Visits: 1665
Lynn Pettis (9/19/2012)
Okay, don't know how many ways I can say it. It looks like you need to add the -S parameter to your BCP command line. Without it BCP is trying to connect to the default instance of SQL Server and you have specified that you are using a named instance on the new server. This means you need to tell bcp the name of the instance.

This:



SELECT @sMysql = 'bcp "SELECT sOutput FROM MYDATABASE.dbo.VPOSITIVEPAY" queryout ' + @sFilePath + @sFileName + ' -S [SQLSVR04\SS2005] -T -c'




Notice the -S parameter I have added.



Lynn,

I did not see the -s param n any of the previous posts. It wasn't until this last post when the comments pointed to something not being seen that I realized there was more text then what I was seeing. My browser was only showing up thru to the '+@sFileName' piece and I did not reliaze there was anything more/diferfent after. If I had I certainly would not have continued to post lengthy messages and do tests when there was something to try that I had not done. Thank you.


That said, it still failed and I copied your sample code just to make sure I did not miss anything or cotain any typos. And I did try it like this:


SELECT @sMysql = 'bcp "SELECT sOutput FROM MYDATABASE.dbo.VPOSITIVEPAY" queryout ' + @sFilePath + @sFileName + ' -S [SQLSVR04\SS2005] -T -c'




And like this just in case it made a difference:


SELECT @sMysql = 'bcp "SELECT sOutput FROM [SQLSVR04\SS2005].MYDATABASE.dbo.VPOSITIVEPAY" queryout ' + @sFilePath + @sFileName + ' -S [SQLSVR04\SS2005] -T -c'




What is DIFFERENT using the -S param is that the query fails when run from the old server and the new server. This is the first test where it failed when run from the old server.

Thanks

Kindest Regards,

Just say No to Facebook!
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
On the new server, what was the error message? (Sorry, but saying it failed doesn't tell us anything.)

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
The following worked on my laptop system which uses a named instance for SQL Server 2005:



bcp "select * from master.sys.databases" queryout C:\Users\lynn.pettis\testfile.txt -S ISS203897\ISS2K5 -T -c




The following failed on my laptop system which uses a named instance for SQL Server 2005:



bcp "select * from master.sys.databases" queryout C:\Users\lynn.pettis\testfile.txt -T -c





So, with that, try this:



SELECT @sMysql = 'bcp "SELECT sOutput FROM MYDATABASE.dbo.VPOSITIVEPAY" queryout ' + @sFilePath + @sFileName + ' -S SQLSVR04\SS2005 -T -c'




Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
Bump. Have you tried my latest change? You know, not including the [ ] around the server name and instance name with the -S parameter to bcp?

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
YSLGuru
YSLGuru
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1846 Visits: 1665
Lynn Pettis (9/19/2012)
Bump. Have you tried my latest change? You know, not including the [ ] around the server name and instance name with the -S parameter to bcp?


Lynn,

I'm just now getting back to working on this. I just tried your last suggestion and that one DID work. While I'm gald to get this working I am curious as to what it is about the new server that reuires this kind of change. Is it just because its a named instance?

Kindest Regards,

Just say No to Facebook!
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
YSLGuru (9/20/2012)
Lynn Pettis (9/19/2012)
Bump. Have you tried my latest change? You know, not including the [ ] around the server name and instance name with the -S parameter to bcp?


Lynn,

I'm just now getting back to working on this. I just tried your last suggestion and that one DID work. While I'm gald to get this working I am curious as to what it is about the new server that reuires this kind of change. Is it just because its a named instance?


Yes, as I believe I mentioned a few posts back. When you don't include the -S parameter BCP attempts to connect to the default instance of SQL Server on the server that it is being run on. This is why it would run on the old server. You were probably able to access the data on the new server, and this is a guess on my part, because you probably have a linked server defined on the old server pointing to the new server. When you added the -S parameter, the problem then was we kept the square brackets around the servername\instancename and bcp didn't like it. That's when I played with bcp on my laptop and found that those needed to go bye bye.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
YSLGuru
YSLGuru
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1846 Visits: 1665
Lynn Pettis (9/20/2012)
YSLGuru (9/20/2012)
Lynn Pettis (9/19/2012)
Bump. Have you tried my latest change? You know, not including the [ ] around the server name and instance name with the -S parameter to bcp?


Lynn,

I'm just now getting back to working on this. I just tried your last suggestion and that one DID work. While I'm gald to get this working I am curious as to what it is about the new server that reuires this kind of change. Is it just because its a named instance?


Yes, as I believe I mentioned a few posts back. When you don't include the -S parameter BCP attempts to connect to the default instance of SQL Server on the server that it is being run on. This is why it would run on the old server. You were probably able to access the data on the new server, and this is a guess on my part, because you probably have a linked server defined on the old server pointing to the new server. When you added the -S parameter, the problem then was we kept the square brackets around the servername\instancename and bcp didn't like it. That's when I played with bcp on my laptop and found that those needed to go bye bye.



Lynn,

Corret me if I'm wrong but with the exception of this BCP specific case, aren't the use of the brackets always required when using a name that includes the slash for a namaed instance?

thanks

Kindest Regards,

Just say No to Facebook!
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40210 Visits: 38567
YSLGuru (9/24/2012)
Lynn Pettis (9/20/2012)
YSLGuru (9/20/2012)
Lynn Pettis (9/19/2012)
Bump. Have you tried my latest change? You know, not including the [ ] around the server name and instance name with the -S parameter to bcp?


Lynn,

I'm just now getting back to working on this. I just tried your last suggestion and that one DID work. While I'm gald to get this working I am curious as to what it is about the new server that reuires this kind of change. Is it just because its a named instance?


Yes, as I believe I mentioned a few posts back. When you don't include the -S parameter BCP attempts to connect to the default instance of SQL Server on the server that it is being run on. This is why it would run on the old server. You were probably able to access the data on the new server, and this is a guess on my part, because you probably have a linked server defined on the old server pointing to the new server. When you added the -S parameter, the problem then was we kept the square brackets around the servername\instancename and bcp didn't like it. That's when I played with bcp on my laptop and found that those needed to go bye bye.



Lynn,

Corret me if I'm wrong but with the exception of this BCP specific case, aren't the use of the brackets always required when using a name that includes the slash for a namaed instance?

thanks


I think you only need them when using 4-part naming convention when specifying tables/views in a FROM clause. You use them due to the \ in the name. I think you would leave them off when specifying the server in a SQLCMD command line as well.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search