sql server parameter validation of stored procedure
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
sql server parameter validation of stored procedure的更多相关文章
- Microsoft SQL Server Version List [sqlserver 7.0-------sql server 2016]
http://sqlserverbuilds.blogspot.jp/ What version of SQL Server do I have? This unofficial build ch ...
- Microsoft SQL Server Version List(SQL Server 版本)
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...
- [转]Dynamic SQL & Stored Procedure Usage in T-SQL
转自:http://www.sqlusa.com/bestpractices/training/scripts/dynamicsql/ Dynamic SQL & Stored Procedu ...
- MySQL and Sql Server:Getting metadata using sql script (SQL-92 standard)
MySQL: use sakila; -- show fields from table_name; -- show keys from table_name; SELECT `REFERENCED_ ...
- Migrating Oracle on UNIX to SQL Server on Windows
Appendices Published: April 27, 2005 On This Page Appendix A: SQL Server for Oracle Professionals Ap ...
- [转]Mapping Stored Procedure Parameters in SSIS OLE DB Source Editor
本文转自:http://geekswithblogs.net/stun/archive/2009/03/05/mapping-stored-procedure-parameters-in-ssis-o ...
- Easy way to change collation of all database objects in SQL Server
This info is from: http://www.codeproject.com/Articles/302405/The-Easy-way-of-changing-Collation-of- ...
- SQL Server 2014 Backup Encryption
转载自: Microsoft MVP Award Program Blog 来源:Microsoft MVP Award Program Blog 的博客:https://blogs.msdn.mic ...
- SQL Server 内存中OLTP内部机制概述(四)
----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<SQL Server In-Memory ...
随机推荐
- 关于java类加载器的一些概念
顾名思义,类加载器(class loader)用来加载 Java 类到 Java 虚拟机中.一般来说,Java 虚拟机使用 Java 类的方式如下:Java 源程序(.java 文件)在经过 Java ...
- Expression<Func<T, bool>>与Func<T, bool>的区别
转自:http://www.cnblogs.com/wow-xc/articles/4952233.html Func<TObject, bool>是委托(delegate) Expres ...
- python学习【第八篇】python模块
模块与包 模块的概念 在python中一个.py文件就是一个模块. 使用模块可以提高代码的可维护性. 模块分为三种: python标准库 第三方模块 自定义模块 模块的导入方法 1.import语句 ...
- 前台传递给后台的JSON字符串中的引号 “” 在JAVA后台被转义为 "
前台传递给后台的JSON字符串中的引号 "" 在JAVA后台被转义为 " 1.问题: 前台数据,JSON字符串带有引号 "" ,数据被传递到后台 ...
- box-shadow阴影效果
.shadowBox{ -moz-box-shadow:5px 5px 5px #A9A9A9; -webkit-box-shadow:5px 5px 5px #A9A9A9; box-shadow: ...
- Delphi里的Windows消息(可查MSDN指定位置)
各种控件的通知消码和控制消息可由MSDN-> Platform SDK-> User Interface Services->Windows User Interface->C ...
- random模块一些常用的东西
import random#一.随机小数# (1)大于0且小于1之间的小数print(random.random())# (2)大于1且小于9之间的小数print(random.uniform(0,9 ...
- 010-spring事务管理
一.Spring的事务传播行为 事务是从哪里传播到哪里? 是从方法A传播至方法B. Spring事务类型详解: PROPAGATION_REQUIRED--如果当前没有事务,就新建一个事务.如果有,就 ...
- Win10在右键菜单添加“在此处打开命令窗口”设置项
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere] @="在此处打开命令 ...
- 指定Python线程数目
可以通过threading.semaphore()来指定并行运行的Python线程的数目. #!/usr/bin/python2.7 #File: threadsNum.py #Author: lxw ...