BCP导出数据转换

时间:2018-03-30 04:52:35

标签: sql-server-bcp

ALTER PROCEDURE [dbo].[sp_helptext3] 
    (@ProcName VARCHAR(256))
AS
    SET NOCOUNT ON
BEGIN
    DECLARE @path VARCHAR(MAX)
    DECLARE @filepath_loction VARCHAR(MAX)

    SET @filepath_loction = '\\SOLVERLAPT292\tempfolder\new.txt'

    EXEC @path = sp_helptext2 @ProcName 

    SET @filepath_loction = @path
    SET @sql = 'bcp "' + @sql + '" queryout "' +  @filename +'" -c -r"''\n" 
-t"'',''" -S '+@@servername+' -T'

    SELECT @filepath_loction
END

输出我得到它因为没有转换成文本文件格式我得到这个错误:

  

Msg 214,Level 16,State 201,Procedure xp_cmdshell,Line 1
  过程需要'varchar'类型的参数'command_string'。

0 个答案:

没有答案