weird error from stored proc

  • Guys,

    I have the following stored procedure - insertest2 which tries to print the results of the stored proc sp_generate_inserts. I get the following error. But the strange thing is stored proc runs fine from sql server 2005 the management studio

    'SQLState = 42000, NativeError = 536

    Error = [Microsoft][SQL Native Client][SQL Server]Invalid length parameter passed to the SUBSTRING function.'

    alter PROCEDURE INSERTTEST2 ( @FILEPATH NVARCHAR(50))

    AS

    DECLARE @cmd varchar(2000)

    BEGIN

    set @cmd = 'bcp.exe "EXEC SP_GENERATE_INSERTS auth" '

    + 'QUERYOUT' + ' ' +@filePath+ '.sql ' +'-S ' +

    'NV-DEVSQL3\ASTRO' + ' -q ' + ' -c -T -e' + @filePath+'.log -o '

    + @filePath+ '_out.log'

    select @cmd -- + '...'

    EXEC master.dbo.xp_cmdShell @cmd

    END

    This also blog on msdn forums for this issue but it doesnt seem to make sense.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=236674&SiteID=1

    Any suggestions/inputs would help.

    Thanks

  • Asked and answered here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=86434

     


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply