下面两句中出现的 “SetFileName” 和 “addLine”被当作存储过程但是SQL中并没有找到这两个存储过程所以
 EXEC @rt = SetFileName @szFileName
 Exec @rt = addLine @szText

解决方案 »

  1.   

    exec sp_addextendedproc 'SetFileName', 'storeproc.dll'
    exec sp_addextendedproc 'addLine', 'storeproc.dll'
    go
    CREATE PROCEDURE sp_testdll ASdeclare @szFileName varchar(200)
    declare @szText varchar(200)
    declare @rt intSelect @szFileName = 'c:\welcome.txt'EXEC @rt = SetFileName @szFileName
    if @rt = 0
    begin
    select @szText = 'welcome 01'
    Exec @rt = addLine @szText
    select @szText = 'welcome 02'
    Exec @rt = addLine @szTextend
    go
    exec sp_dropextendedproc 'SetFileName'
    exec sp_dropextendedproc 'addLine'dbcc SetFileName(free)
    dbcc addLine(free)
      

  2.   

    exec sp_addextendedproc 'SetFileName', 'storeproc.dll'
    exec sp_addextendedproc 'addLine', 'storeproc.dll'
    go
    CREATE PROCEDURE sp_testdll ASdeclare @szFileName varchar(200)
    declare @szText varchar(200)
    declare @rt intSelect @szFileName = 'c:\welcome.txt'EXEC @rt = SetFileName @szFileName
    if @rt = 0
    begin
    select @szText = 'welcome 01'
    Exec @rt = addLine @szText
    select @szText = 'welcome 02'
    Exec @rt = addLine @szTextend
    go
    exec sp_dropextendedproc 'SetFileName'
    exec sp_dropextendedproc 'addLine'dbcc SetFileName(free)
    dbcc addLine(free)
      

  3.   

    to  pengdali(大力 V2.0) 
    请问我把原来的改成
    Create PROCEDURE sp_testdll ASdeclare @szFileName varchar(200)
    declare @szText varchar(200)
    declare @rt intSelect @szFileName = 'c:\welcome.txt'EXEC @rt = SetFileName @szFileName
    if @rt = 0
    begin
    select @szText = 'welcome 01'
    Exec @rt = addLine @szText
    select @szText = 'welcome 02'
    Exec @rt = addLine @szTextend
    现在他还是出错啊
    提示是不能在事务内部执行过程sp_addextendedproc,
    未能找到存储过程SetFileName 
    语句已经中止
    exec sp_addextendedproc 'SetFileName', 'storeproc.dll'
    exec sp_addextendedproc 'addLine', 'storeproc.dll'
    我已经提前执行了啊