EXEC master..xp_cmdshell 'bcp ptdata.dbo.tb_users out e:/temp2.xls -c -q -S"WWW-75AF6DAC011" -U"sa" -P"y_ht_1987#"' --这样子是导出整张表
EXEC master..xp_cmdshell 'BCP "SELECT usnikname FROM tb_users" queryout e:/temp2.xls -c -U"sa" -P"y_ht_1987#"' --有选择性的导出数据
--同理导出到记事本(txt):如下
EXEC master..xp_cmdshell 'bcp ptdata.dbo.tb_users out e:/temp2.txt -c -q -S"WWW-75AF6DAC011" -U"sa" -P"y_ht_1987#"' --这样子是导出整张表
EXEC master..xp_cmdshell 'BCP "SELECT usnikname FROM tb_users" queryout e:/temp2.txt -c -U"sa" -P"y_ht_1987#"' --有选择性的导出数据