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
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 BCP and SQL Server Port

Author  Topic 

SQLJames
Starting Member

35 Posts

Posted - 2015-03-24 : 17:59:26
I want to BCP data out of SQL Server but the SQL Server is not using the standard port. Is there a way to pass in the port when issuing the BCP command?

I have tried:

BCP <options> -S "Server,Port"
AND
BCP <option> -S "Server:Port"

Any suggestions? I did find some posts where the suggestion was made to create an alias to SQL Server. I am hoping to avoid that.

Any suggestions are greatly appreciated!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-24 : 18:02:17
Doesn't this work: -S server,port

If it doesn't, then yeah you'll need to use an alias or figure out why the SQL Browser isn't getting you to the right port.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

SQLJames
Starting Member

35 Posts

Posted - 2015-03-24 : 18:06:41
Unfortunately, no that doesn't work. I guess I am going to have to explore the alias route. Thank you for the reply.
Go to Top of Page

SQLJames
Starting Member

35 Posts

Posted - 2015-03-24 : 18:26:48
I don't like the solution but I found one.

I created an alias as outlined in this article: [url]http://www.mssqltips.com/sqlservertip/2459/using-a-sql-server-alias-for-ssis-package-configuration-database-connection-string/[/url]

Then used the alias in the BCP statement. It worked.

Now I have to convince our network security group to let me do that on the production machine.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-24 : 18:55:38
There's no risk to it provided you do it correctly. Script it out from your test server using regedit and then just double click on the file in production to create the same alias.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

SQLJames
Starting Member

35 Posts

Posted - 2015-03-26 : 13:05:04
Thanks for the follow-up!

I appreciate your time.
Go to Top of Page

SQLJames
Starting Member

35 Posts

Posted - 2015-03-26 : 13:59:51
I hate being wrong but I hate perpetuating incorrect information more so I want to correct this.

It turns out that you can use the port with the server. The problem I had was that when I was running BCP with bcp.exe it was running the Sybase BCP program. When I used the full path for SQL Server and used the -S<Server,Port> syntax, it worked.

Lesson learned.

Thank you again for your help.
Go to Top of Page
   

- Advertisement -