0
INSERT INTO DVR_DOCUMENTS(path, Document)
Select 
       'C:\2.csv', 1.csv  
    FROM OPENROWSET 
       (BULK 'C:\2.csv', SINGLE_BLOB) Document

Declare @sql varchar(500)

set @sql = 'BCP "select DOCUMENT from [dbname].dbo.DVR_DOCUMENTS Where ID=1" QUERYOUT C:\7.CSV -T -f C:\DVR_DOCUMENTS.fmt -S ' + @@SERVERNAME

print @SQL
EXEC master.dbo.xp_CmdShell @sql

bcp "select DOCUMENT from [Dbname].dbo.DVR_DOCUMENTS Where ID=9" queryout C:\7.pdf -T -c

输出

NULL
Starting copy...
NULL
1 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1      Average : (1000.00 rows per sec.)
NULL

我无法下载我上传的文件。任何人都可以帮忙吗?

4

1 回答 1

0

声明 @SQLcommand nvarchar(4000) set @SQLcommand ='bcp "SELECT [DOCUMENT] FROM ngap_poc.dbo.DVR_DOCUMENTS Where Id=11" queryout "C:\test03.pdf" -T -n '

exec xp_cmdshell @SQLcommand

于 2013-06-28T12:32:12.160 回答