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 ...
随机推荐
- 第一章----python简介
1.python简介 定义:python是一种计算机程序设计语言,是一种相当高级的语言,是用来编写应用程序的高级编程语言: 特点:优势:简单易用:提供了非常完善的基础代码库:优雅,明确,简单.劣势 : ...
- php 正则匹配省市区
匹配指定前后内容中的值 如匹配/xxx-abc中的abc preg_match('/\/xxx-([^<]*)/i', $route, $matches); echo $matches[1]; ...
- iOS学习笔记(二)——Hello iOS
前面写了iOS开发环境搭建,只简单提了一下安装Xcode,这里再补充一下,点击下载Xcode的dmp文件,稍等片刻会有图一(拖拽Xcode至Applications)的提示,拖拽至Applicatio ...
- 巨蟒python全栈开发linux之centos6
1.nginx复习 .nginx是什么 nginx是支持反向代理,负载均衡,且可以实现web服务器的软件 在129服务器中查看,我们使用的是淘宝提供的tengine,也是一种nginx服务器 我们下载 ...
- Java基础 - 流程控制语句
package com.demo4; /* * 流程控制语句 * 流程控制语句分类: * 顺序结构 * 代码从上往下按照顺序执行 * * 选择结构 * if * if (关系表达式1) { * 语句体 ...
- return和yield的区别
# return 返回给调用者值,并结束此函数.#yiled 返回给调用者值,并将指针停留着当前位置.
- MySQL学习思维导图
结束:分享在线下载地址 https://www.xmind.net/m/7t6U/
- 检测tomcat服务是否正常
由于tomcat服务经常会出现进程在,但是服务却无法正常响应的问题,而且进程跑在docker容器中,使用zabbix控制不是很方便,故此写了个简单的小脚本: #!/bin/bash #Author:f ...
- C#对Excel中指定一列或一行实现隐藏或显示!
C#对Excel中指定一列或一行实现隐藏或显示!不会,求指导!
- django 操作前端数据
django 利用json处理前端页面数据,FLASK当中也同样 def create_company(request):if request.user.is_superuser:custom_l ...