try:
EXEC master..xp_cmdshell 'bcp sz_data.dbo.trlog out c:\temp1.txt -c -q -S"servername" -U"sa" -P""'
EXEC master..xp_cmdshell 'bcp sz_data.dbo.trlog out c:\temp1.txt -c -q -S"servername" -U"sa" -P""'
调试欢乐多
Error = [Microsoft][ODBC SQL Server Driver][DBMSLPCN]SQL Server 不存在或访问被拒绝
SQLState = 01000, NativeError = 67
Warning = [Microsoft][ODBC SQL Server Driver][DBMSLPCN]ConnectionOpen (Connect()).
NULL
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]无法打开 BCP 主数据文件
在MS-DOS模式下输入:
c:>path
看看path中间有没有把MSSQL的binn目录加进去。
如果没有,那幺就要写全了(假设你是SQL Server7.0,而且装在d盘):
exec master..xp_cmdshell 'd:\mssql7\binn\bcp.exe sz_data.dbo.trlog out c:\belly\a1.txt -Secs -c -Usa -P'
应该显示BCP的参数信息,如果没有就如楼上的方法,到\mssql\binn\目录下运行。
从微软的解释来看
“在 bcp_init 调用中指定的文件名不存在,或已由另一个应用程序打开。”
你TRY BELOW:
exec master..xp_cmdshell 'bcp sz_data.dbo.trlog out c:\a1.txt -Secs -c -Usa -P'