2

i can connect to database with management studio but i cant remote to that windows. how can write bcp "select" Without remotely accessing the server? tanx

bcp "Select personelid, '13'+date date, scheduleid, scheduleGroupName, DetailCollectionID, Name, TimesStructure, DayNO, Sequence, WPID, ToleranceTimes, DayState, StructureID, ID, STime, ETime from framework.att.PersonDateStructure" queryout "D:\test\pds.txt" -T -c
Mohammad Naghsh
  • 207
  • 3
  • 10
  • 2
    Does this answer your question? [How to write using BCP to a remote SQL Server?](https://stackoverflow.com/questions/42655247/how-to-write-using-bcp-to-a-remote-sql-server) –  Dec 08 '19 at 09:54
  • 1
    @Mohammad; Please mark the answer if it was helpful or comment it if-else. – XAMT Apr 16 '20 at 07:28

1 Answers1

1

Sample from your code :

bcp "Select personelid, '13'+date date, scheduleid, scheduleGroupName, DetailCollectionID, Name, TimesStructure, DayNO, Sequence, WPID, ToleranceTimes, DayState, StructureID, ID, STime, ETime from framework.att.PersonDateStructure" queryout "D:\test\pds.txt" -T -c -S 10.0.0.108 -U sa -P 0000

My DB-Server address is 10.0.0.108 so change it plz, also put your username and password

Latest BPC version : Download here

-S server_name [\instance_name]

Specifies the instance of SQL Server to which to connect. If no server is specified, the bcp utility connects to the default instance of SQL Server on the local computer. This option is required when a bcp command is run from a remote computer on the network or a local named instance. To connect to the default instance of SQL Server on a server, specify only server_name. To connect to a named instance of SQL Server, specify server_name\instance_name.

-U login_id

Specifies the login ID used to connect to SQL Server.

-P password

Specifies the password for the login ID. If this option is not used, the bcp command prompts for a password. If this option is used at the end of the command prompt without a password, bcp uses the default password (NULL).

Detail Info : https://learn.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15#S

XAMT
  • 1,515
  • 2
  • 11
  • 31