易截截图软件、单文件、免安装、纯绿色、仅160KB

mssql存储过程中容错处理 - MS-SQL Server / 基础类

exec YYys 'aa' aa是mssql非正确的语句,
里面是通过 exec (@sql)--上面aa所传递的参数就是@sql调用的,如果如何让exec @sql出错后存储过程能输出错误。
这个?

貌似很难,类似人为错误只能从行政方面入手.

没理解lz的目的


SQL code:
declare @msg nvarchar(4000)
declare @severity int

IF @@ERROR <> 0
BEGIN
select @msg=description,@severity=severity from sysmessages where msglangid = 2052 and error=@@ERROR
--print @msg
RAISERROR (@msg, @severity, 1)

END


SQL code:

declare @msg nvarchar(4000)
declare @severity int
exec('aa')
IF @@ERROR <> 0
BEGIN
select @msg=description,@severity=severity from sysmessages where msglangid = 2052 and error=@@ERROR
--print @msg
RAISERROR (@msg, @severity, 1)

END
/*
服务器: 消息 2812,级别 16,状态 62,行 1
找不到存储过程 'aa'。
*/


引用
SQL code

declare @msg nvarchar(4000)
declare @severity int
exec('aa')
IF @@ERROR <> 0
BEGIN
select @msg=description,@severity=severity from sysmessages where msglangid = 2052 and error=@@……

/*
服务器: 消息 2812,级别 16,状态 62,行 1
找不到存储过程 'aa'。
*/


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

MS SQL作业问题 - MS-SQL Server / 应用实例

如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP

参考:http://hi.baidu.com/toiota ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......

请教SQL语句查询问题? - MS-SQL Server / 基础类

我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间  
  Id value state dattime  
  101 32.3 0 ......

java windows7 MSSQL - Java / Java SE

使用java在windows7 32位下连接MSSQL。
两台机器,windows7 32位,在控制面板里面全部设置语言和区域选项都english-unitedstates
唯一区别只有在安装SQL server 2008的时候 选择的字符集不一样,
exec sp_helpsor ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号