这一般可以在调用存储过程时,捕捉错误
如catch

解决方案 »

  1.   

    --SQL的严重错误处理,他的错误信息捕捉不到!错误级别高的错误信息.--所以建议用条件判断这个唯一ID是否存在数据库中,如果不存在就插入,存在就返回。这么处理!!
      

  2.   

    这种已知会出现错误的地方,最好在前台处理使用前台开发工具的捕捉错误语句处理,如C#中:try
    {
    }
    catcht()
    {
    }
      

  3.   

    定制master..sysobjects的出错提示
      

  4.   

    有没有 使用 RAISERROR  方法的完整的例子啊
      

  5.   

    create procedure sp_test
    ascreate table #t(a int)declare @b intselect top 1 @b=a from #tif @b is null
    begin
       raiserror ('未取到值', 16, 1)
       return -100
    endGO
      

  6.   


    Declare @a int
    declare @b intset @a=0
    set @b=1select @b=@b/@a
    if @@error<>0 
        raiserror ('未取到值', 16, 1)