“could not find stored procedure”

后端 未结 10 1204
死守一世寂寞
死守一世寂寞 2020-12-20 11:43

I am maintaining a classic ASP website that has a SQL Server 2005 backend. For a small piece of new functionality I wrote a stored procedure to do an insert. This is the o

10条回答
  •  鱼传尺愫
    2020-12-20 12:15

    Sometimes this can also happen when you have a stored procedure being called with parameters. For example, if you type something like:

    set @runProc = 'dbo.StoredProcedure'
     exec @runProc
    

    This will work, However:

    set @runProc = 'dbo.StoredProcedure ''foods'''
    exec @runProc
    

    This will throw the error "could not find stored procedure dbo.StoredProcedure 'foods'", however this can easily be overcome with parantheses like so:

    set @runProc = 'exec dbo.StoredProcedure ''foods'''
    exec (@runProc)
    

提交回复
热议问题