https://stackoverflow.com/questions/41908156/validating-missing-parameter-from-procedure-calls

I don't think that there is a single "right" way to do this.

My own preference would be similar to your second example, but with a separate validation step for each parameter and more explicit error messages.

As you say, it's a bit cumbersome and ugly, but the intent of the code is obvious to anyone reading it, and it gets the job done.

IF (ISNULL(@fooInt, 0) = 0)
BEGIN
RAISERROR('Invalid parameter: @fooInt cannot be NULL or zero', 18, 0)
RETURN
END IF (ISNULL(@fooString, '') = '')
BEGIN
RAISERROR('Invalid parameter: @fooString cannot be NULL or empty', 18, 0)
RETURN
END

最新文章

  1. Collections.shuffle
  2. cordova iOS blank iframe iphone iframe 白屏 ios iframe 白屏
  3. jquery里面的循环的用法
  4. GitBash上传代码不计入贡献的问题处理
  5. Java开发者值得关注的7款新工具
  6. wireshark使用心得
  7. OpenSSL “心脏滴血”漏洞
  8. UVA 1839 Alignment
  9. ThinkPHP中实例化对象M()和D()的区别,select和find的区别
  10. sklearn中各算法类的fit,fit_transform和transform函数
  11. tomcat默认日志路径更改
  12. 反射模拟DbUtils实现ResultSet转成Bean实例
  13. [OPEN CV] 常用视频操作方法
  14. php函数 array_chunk
  15. uploadfy 图片/视频上传
  16. 解决wireshark检测不到网卡的问题
  17. Ubuntu16.04阿里云源
  18. C# EPPlus导出EXCEL,并生成Chart表
  19. 工具类 | window批处理杀死指定端口进程
  20. Webx示例-PetStore分析1

热门文章

  1. Android开发:《Gradle Recipes for Android》阅读笔记(翻译)4.2——增加自定义task
  2. Retrofit学习笔记(一)
  3. iOS学习笔记(十一)——JSON数据解析
  4. sql server 2008获取表的字段注释
  5. 【BZOJ1731】[Usaco2005 dec]Layout 排队布局 差分约束
  6. javascript获取客户端默认打印机
  7. JavaScript处理数据完成左侧二级菜单的搭建
  8. POJ 1408 Fishnet【枚举+线段相交+叉积求面积】
  9. 微信小程序-学习总结(1)
  10. Vue的插值与表达式