sql server parameter validation of stored procedure
2024-09-03 03:59:19
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
最新文章
- Collections.shuffle
- cordova iOS blank iframe iphone iframe 白屏 ios iframe 白屏
- jquery里面的循环的用法
- GitBash上传代码不计入贡献的问题处理
- Java开发者值得关注的7款新工具
- wireshark使用心得
- OpenSSL “心脏滴血”漏洞
- UVA 1839 Alignment
- ThinkPHP中实例化对象M()和D()的区别,select和find的区别
- sklearn中各算法类的fit,fit_transform和transform函数
- tomcat默认日志路径更改
- 反射模拟DbUtils实现ResultSet转成Bean实例
- [OPEN CV] 常用视频操作方法
- php函数 array_chunk
- uploadfy 图片/视频上传
- 解决wireshark检测不到网卡的问题
- Ubuntu16.04阿里云源
- C# EPPlus导出EXCEL,并生成Chart表
- 工具类 | window批处理杀死指定端口进程
- Webx示例-PetStore分析1
热门文章
- Android开发:《Gradle Recipes for Android》阅读笔记(翻译)4.2——增加自定义task
- Retrofit学习笔记(一)
- iOS学习笔记(十一)——JSON数据解析
- sql server 2008获取表的字段注释
- 【BZOJ1731】[Usaco2005 dec]Layout 排队布局 差分约束
- javascript获取客户端默认打印机
- JavaScript处理数据完成左侧二级菜单的搭建
- POJ 1408 Fishnet【枚举+线段相交+叉积求面积】
- 微信小程序-学习总结(1)
- Vue的插值与表达式