【问题标题】:how can write bcp select Without remotely accessing the server? [duplicate]如何在不远程访问服务器的情况下编写 bcp select ? [复制]
【发布时间】:2019-12-08 09:49:20
【问题描述】:

我可以使用管理工作室连接到数据库,但我无法远程访问该窗口。 如何在不远程访问服务器的情况下编写 bcp "select"? 坦克

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

【问题讨论】:

标签: sql-server


【解决方案1】:

您的代码示例:

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

我的 DB-Server 地址是 10.0.0.108 所以请更改它,也把你的 用户名和密码

最新 BPC 版本:Download here

-S server_name [\instance_name]

指定要连接的 SQL Server 实例。如果未指定服务器,bcp 实用程序将连接到本地计算机上的默认 SQL Server 实例。当从网络上的远程计算机或本地命名实例运行 bcp 命令时,需要此选项。要连接到服务器上的默认 SQL Server 实例,请仅指定 server_name。要连接到 SQL Server 的命名实例,请指定 server_name\instance_name。

-U login_id

指定用于连接 SQL Server 的登录 ID。

-P密码

指定登录 ID 的密码。如果未使用此选项,bcp 命令将提示输入密码。如果在没有密码的命令提示符末尾使用此选项,则 bcp 使用默认密码 (NULL)。

详细信息:https://docs.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15#S

【讨论】:

  • 你能改变我的代码吗?
  • @MohammadNaghsh:请再检查一遍。
  • 我收到此错误 SQLState = 28000, NativeError = 18456 错误 = [Microsoft][SQL Server 的 ODBC 驱动程序 13][SQL Server]用户 'KASRA\mnaghsh' 登录失败。
  • 如果你确定 user/pass 试试 -G 参数。
猜你喜欢
  • 1970-01-01
  • 2020-11-12
  • 2015-12-05
  • 2012-03-22
  • 1970-01-01
  • 2022-06-23
  • 2011-02-24
  • 1970-01-01
  • 2012-11-17
相关资源
最近更新 更多