2013-06-25 74 views
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 

輸出BCP出口問題2008 R2

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

我無法下載我所上傳的文件。誰能幫忙?

回答

0

申報@SQLcommand爲nvarchar(4000) 組@SQLcommand = 'BCP 「SELECT [文獻] FROM ngap_poc.dbo.DVR_DOCUMENTS其中id = 11」 queryout 「C:\ test03.pdf」 -T -n'

exec xp_cmdshell @SQLcommand