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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. [转]Dynamic SQL & Stored Procedure Usage in T-SQL

    转自:http://www.sqlusa.com/bestpractices/training/scripts/dynamicsql/ Dynamic SQL & Stored Procedu ...

  4. 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_ ...

  5. 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 ...

  6. [转]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 ...

  7. 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- ...

  8. SQL Server 2014 Backup Encryption

    转载自: Microsoft MVP Award Program Blog 来源:Microsoft MVP Award Program Blog 的博客:https://blogs.msdn.mic ...

  9. SQL Server 内存中OLTP内部机制概述(四)

    ----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<SQL Server In-Memory ...

随机推荐

  1. go语言获取字符串元素的个数

    1:获取字符串字节的个数,并按字节挨个输出 package main import ( "fmt" ) func main() { var str string = "a ...

  2. Laragon集成开发环境+配置Xdebug+postman运行Xdebug

    [ Laravel 5.5 文档 ] 快速入门 —— 使用 Laragon 在 Windows 中搭建 Laravel 开发环境:http://laravelacademy.org/post/7754 ...

  3. http://www.haolizi.net/example/view_2380.html

    null

  4. NGUI Checkbox与PlayerPrefs

    UICheckboxPrefs.cs 1,bool isChecked:false 为“初始”状态,true为“选中”: 2,bool startsChecked:true,一运行,就显示UISpri ...

  5. Java数据类型的转换:隐式(自动)转换与强制转换

    原文链接:http://java.chinaitlab.com/base/725590.html 一些初学JAVA的朋友可能会遇到JAVA的数据类型之间转换的苦恼,例如,整数和float,double ...

  6. 《从零开始学Swift》学习笔记(Day 49)——扩展声明

    原创文章,欢迎转载.转载请注明:关东升的博客 声明扩展的语法格式如下: extension 类型名 { //添加新功能 } 声明扩展的关键字是extension,“类型名”是Swift中已有的类型,包 ...

  7. 《从零开始学Swift》学习笔记(Day 46)——下标重写

    原创文章,欢迎转载.转载请注明:关东升的博客 下标是一种特殊属性.子类属性重写是重写属性的getter和setter访问器,对下标的重写也是重写下标的getter和setter访问器. 下面看一个示例 ...

  8. 1366 贫富差距(floyed)

    1366 贫富差距 题目来源: TopCoder 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 一个国家有N个公民,标记为0,1,2,...,N-1,每个公民有一 ...

  9. Chart控件文档

    假设c1Chart1为Chart控件的一个实例. 一.基本框架图 二.主要外层属性(即this.c1Chart1的主要属性) 1.Header和Footer,上标题和下标题.位于this.c1Char ...

  10. Maven + Jetty 部署锁文件解决办法

    用Maven + Jetty 在Eclipse环境启动后,改静态文件的时候出现如下提示 就表示文件被锁住了. 解决办法如下: <plugin> <groupId>org.ecl ...