SQL实战训练2 PowerShell中导出数据到excel表格

1.启动PowerShell

在数据库的实例名上右击,选择"启动PowerShell"

2.输入命令

PS SQLSERVER:\SQL\LENOVO-PC\DEFAULT> bcp YLBX兰考.dbo.ff out e:/123.xls -c -q -S
 "LENOVO-PC" -U "sa" -P "lvyafei"

开始复制...
1000 rows successfully bulk-copied to host-file. Total received: 1000
1000 rows successfully bulk-copied to host-file. Total received: 2000
1000 rows successfully bulk-copied to host-file. Total received: 3000
1000 rows successfully bulk-copied to host-file. Total received: 4000
1000 rows successfully bulk-copied to host-file. Total received: 5000
1000 rows successfully bulk-copied to host-file. Total received: 6000
1000 rows successfully bulk-copied to host-file. Total received: 7000
1000 rows successfully bulk-copied to host-file. Total received: 8000
1000 rows successfully bulk-copied to host-file. Total received: 9000
1000 rows successfully bulk-copied to host-file. Total received: 10000
1000 rows successfully bulk-copied to host-file. Total received: 11000
1000 rows successfully bulk-copied to host-file. Total received: 12000
1000 rows successfully bulk-copied to host-file. Total received: 13000
1000 rows successfully bulk-copied to host-file. Total received: 14000
1000 rows successfully bulk-copied to host-file. Total received: 15000
1000 rows successfully bulk-copied to host-file. Total received: 16000
1000 rows successfully bulk-copied to host-file. Total received: 17000
1000 rows successfully bulk-copied to host-file. Total received: 18000
1000 rows successfully bulk-copied to host-file. Total received: 19000
1000 rows successfully bulk-copied to host-file. Total received: 20000
1000 rows successfully bulk-copied to host-file. Total received: 21000
1000 rows successfully bulk-copied to host-file. Total received: 22000
1000 rows successfully bulk-copied to host-file. Total received: 23000

已复制 23243 行。
网络数据包大小(字节): 4096
总时钟时间(毫秒)     : 483    平均值: (每秒 48122.15 行。)
PS SQLSERVER:\SQL\LENOVO-PC\DEFAULT>

原文地址:https://www.cnblogs.com/lvfeilong/p/fdgfdgdfgdf.html