解决方案 »

  1.   

    没有必要哦要做的话用动态语句create procedure test
    as
    exec('
    create function dbo.fun1.......
    ')
    go
      

  2.   

    我是有必要。我试过,这样不行。会报这样的错误CREATE FUNCTION' must be the first statement in a query batch。
      

  3.   

    我试过,这样不行。会报这样的错误CREATE FUNCTION' must be the first statement in a query batch。
      

  4.   

    你试试这个
    create procedure test
    as
    exec('create function dbo.fun1()RETURNS INT BEGIN RETURN 1 END')
    go
    EXEC test
      

  5.   

    你试试这个
    create procedure test
    as
    exec('create function dbo.fun1()RETURNS INT BEGIN RETURN 1 END')
    go
    EXEC test我知道什么原因了,动态语句我把USE也给加进去了。多谢