请高手指点:用sql命令怎么把一存储过程执行后的含有数据集的结果保存为文本文件? EXEC master..xp_cmdshell 'bcp "临时表名" out c:\DT.txt -c -Sservername -Usa -Ppassword' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如说用select * into #temp from 表名 不过你也可以直接用EXEC master..xp_cmdshell 'bcp "select * from table" queryout "c:\DT.txt" -c -Sservername -Usa -Ppassword' --实践证明,可以直接这样做:EXEC master..xp_cmdshell 'bcp "exec 数据库名..存储过程名" queryout "c:\test.txt" /c /U"用户名" /P"密码"' --要执行的简单存储过程create proc passelect * from 地区资料go--导出存储过程执行结果exec master..xp_cmdshell 'bcp "exec 客户资料..p" queryout "c:\a.txt" /c /P""'go--删除测试的存储过程drop proc p/*--测试结果output ---------------------------NULL开始复制...NULL已复制了 19 行。数据包的大小(字节): 4096时钟时间(毫秒): 共 1NULL(所影响的行数为 7 行)--*/ 关于MSSQL数据库取值的问题?高手帮忙看一下 求一查询sql job一启动,这个JOB的进程都是sleeping sqlserver扩展名问题。谢谢众位高手了。 跪求文本文件导入到SQLSERVER数据库 这句SQL应该怎么写? HELP ME 问高手 这个错误是怎么回事 --------- 进程 ID 56 试图解锁不属于该进程的资源 PAG: 8:1:58753。 还是关于服务器同步的!自己做成功了的进!实际问题郁闷了几天了! 我在建表时如何实现类似SQLServer中GETDATE()的默认值??? 问一个字符串问题? 急!判断多个进行条件选择的问题,用一个SQL语句?
select * into #temp from 表名
EXEC master..xp_cmdshell 'bcp "select * from table" queryout "c:\DT.txt" -c -Sservername -Usa -Ppassword'
create proc p
as
select * from 地区资料
go--导出存储过程执行结果
exec master..xp_cmdshell 'bcp "exec 客户资料..p" queryout "c:\a.txt" /c /P""'
go--删除测试的存储过程
drop proc p/*--测试结果
output
---------------------------
NULL
开始复制...
NULL
已复制了 19 行。
数据包的大小(字节): 4096
时钟时间(毫秒): 共 1
NULL(所影响的行数为 7 行)
--*/