菜菜吃菜 2022-04-11 10:43 采纳率: 57.5%
浏览 27
已结题

c# 删除sql 存储过程语句执行失败

 tiaoshi.Append("use 95 ");
          
            tiaoshi.Append(" go if exists(select * from sys.procedures where name='up')drop procedure updetailgo ");
            


执行提示go 语句出错,但是放在sql manageement中 换行可以执行成功,这个怎么处理呢?
use 95;
go

--判断是否存在存储过程,如果存在则删除
if exists(select * from sys.procedures where name='up')
drop procedure updetail
go

在sql中这样可以执行成功

  • 写回答

1条回答 默认 最新

  • Null_Reference 2022-04-11 11:40
    关注

    updetailgo 放在一起了

    不行的话这样试试

    tiaoshi.Append(@"if exists(select * from sys.procedures where name='up')
    drop procedure updetail
    go");

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 4月19日
  • 已采纳回答 4月11日
  • 创建了问题 4月11日