动态SQL就是我们可以动态构造SQL代码,然后再执行这个批处理。有两种执行动态SQL的方法,分别是EXEC命令和sp_executesql存储过程。下面是示例代码。

USE TSQLFundamentals2008;
GO -- 动态SQL
-- 方法一:EXEC命令(支持普通字符和Unicode字符)
DECLARE @sql AS NVARCHAR(100);
SET @sql=N'PRINT ''这条消息是动态SQL命令打印的.'';';
EXEC(@sql); DECLARE @sql AS NVARCHAR(100);
DECLARE @OrderIDs AS NVARCHAR(50)= '10248,10249,10250';
SET @sql= N'SELECT * FROM Sales.Orders WHERE orderid IN ('+@OrderIDs+');';
EXEC(@sql); -- 方法二:sp_executesql存储过程(只支持Unicode字符)
DECLARE @sql AS NVARCHAR(100);
SET @sql= N'SELECT orderid,custid,empid,orderdate
FROM Sales.Orders
WHERE orderid=@orderid;'; EXEC sys.sp_executesql
@stmt= @sql,
@params= N'@orderid AS INT',
@orderid=10248;

执行结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAADdCAIAAACZl2I7AAAgAElEQVR4nO2d/Y8cx3nn+7+4n3Ln5ODAdkLe2hvJ3pGiUA7l17NjOqRkO5IVO1L7LTHEs0jKLzLWoq1YhiSuIoLUOjmYPjECL6KNmKTHQSAoGwTn2NpJTPjWIIw9ArkQMIyFbJCOYlLQSX0/zExPdddT1dU93dNP73w++KIx21Nd/XQ9VdXfqZmdiTbOfw8hhBBCCKVaXl7+5b+/ELUeB0IIIYSQKmGSEEIIIYQEYZIQQgghhATlTVIyB7Te6AghhBDSr4xJmhMDsWvXrtZjQAghhJByTUzSnDik4TW3vZg1U1pvcIQQQqiLmlOTNFeLSXN1sQghhFBdCjJJ8epA1GKcV+vXE3jNtm9YW1tbW1s7k+XEiZOtR1vL9c6PA0YIIYTqUqhJWh0kI60msUOdNkmrq4Pcu1RbW1vx6mrr0TZ0vQghhBDyq+JKkr2GtBgPFhe3g0m6cuXK4Plk8Hzy1HOX4xiThBBCCM2pgkySucqyvr6ePl5bWxs+uHbt2urqYHExFg+P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M0uWfPLz1i59+7e+feO/KO1/zyf/4mnte9br/9muvvec//ca9v/qBx97945/8qPXoEVKubk0HqFAklKbQps4lolsBF5gkhNA06tZ0gApFQmkKbepcIroVMCYJoQbVrekAFYqE0hTa1LlEdCtgTBJCCCGEkKCMSUIIIYQQQqlGJmkZAAAAALL88t9f+P9f/HCql41ejgAAAABJRU5ErkJggg==" alt="" />

动态SQL基础的更多相关文章

  1. Spring mybatis源码篇章-动态SQL基础语法以及原理

    通过阅读源码对实现机制进行了解有利于陶冶情操,承接前文Spring mybatis源码篇章-Mybatis的XML文件加载 前话 前文通过Spring中配置mapperLocations属性来进行对m ...

  2. Spring mybatis源码篇章-动态SQL节点源码深入

    通过阅读源码对实现机制进行了解有利于陶冶情操,承接前文Spring mybatis源码篇章-动态SQL基础语法以及原理 前话 前文描述到通过mybatis默认的解析驱动类org.apache.ibat ...

  3. Mybatis动态SQL单一基础类型参数用if标签

    Mybatis动态SQL单一基础类型参数用if标签时,test中应该用 _parameter,如: 1 2 3 4 5 6 <select id="selectByName" ...

  4. MyBatis基础入门《二十》动态SQL(foreach)

    MyBatis基础入门<二十>动态SQL(foreach) 1. 迭代一个集合,通常用于in条件 2. 属性 > item > index > collection : ...

  5. mybatis基础系列(三)——动态sql

    本文是Mybatis基础系列的第三篇文章,点击下面链接可以查看前面的文章: mybatis基础系列(二)--基础语法.别名.输入映射.输出映射 mybatis基础系列(一)--mybatis入门 动态 ...

  6. MyBatis基础入门《十九》动态SQL(set,trim)

    MyBatis基础入门<十九>动态SQL(set,trim) 描述: 1. 问题 : 更新用户表数据时,若某个参数为null时,会导致更新错误 2. 分析: 正确结果: 若某个参数为nul ...

  7. MyBatis基础入门《十八》动态SQL(if-where)

    MyBatis基础入门<十八>动态SQL(if-where) 描述: 代码是在<MyBatis基础入门<十七>动态SQL>基础上进行改造的,不再贴所有代码,仅贴改动 ...

  8. MyBatis基础入门《十七》动态SQL

    MyBatis基础入门<十七>动态SQL 描述: >> 完成多条件查询等逻辑实现 >> 用于实现动态SQL的元素主要有: > if > trim > ...

  9. ASP.NET实现二维码 ASP.Net上传文件 SQL基础语法 C# 动态创建数据库三(MySQL) Net Core 实现谷歌翻译ApI 免费版 C#发布和调试WebService ajax调用WebService实现数据库操作 C# 实体类转json数据过滤掉字段为null的字段

    ASP.NET实现二维码 using System;using System.Collections.Generic;using System.Drawing;using System.Linq;us ...

随机推荐

  1. Visual Studio 2010初学者的调试指南:Mastering Debugging in Visual Studio 2010 - A Beginner's Guide

    Introduction In the software development life cycle, testing and defect fixing take more time than a ...

  2. js解析php数组

    <script language="javascript"> var str; //$file = 'config/config.xml'; str = '<?p ...

  3. 0511 backlog

    SCRUM 这次的作业就是确定SCRUM的计划,确定sprint backlog的一个冲刺周期,而这个周期是两个星期.争取在两周内发布1.0版本. 本次作业以网站构建为主: ID       NAME ...

  4. h5移动端前端性能优化

    1.脚本优化 (1)减少重绘和回流 (2)缓存Dom选择与计算 (3)缓存列表length (4)尽量使用事件代码,避免批量绑定事件 (5)尽量使用ID选择器 (6)使用touchstart.touc ...

  5. Objective-C语言Foundation框架

    Mac OS X开发会使用Cocoa框架,它是一种支持应用程序提供丰富用户体验的框架,它实际上由:Foundation和Application Kit(AppKit)框架组成.iOS开发,会使用Coc ...

  6. Android中AIDL通信机制分析

    一.背景 ·1.AIDL出现的原因 在android系统中,每一个程序都是运行在自己的进程中,进程之间无法进行通讯,为了在Android平台,一个进程通常不能访问另一个进程的内存空间,所以要想对话,需 ...

  7. web工程目录结构

    /WEB-INF/web.xml Web应用程序配置文件,描述了 servlet 和其他的应用组件配置及命名规则. /WEB-INF/classes/包含了站点所有用的 class 文件,包括 ser ...

  8. yii2框架原生的结合框架使用的图片上传

    首先我们要从model层开始写起,主要是为了创建验证规则,还有图片上传的路径以及图片的命名规则(UploadForm.php) 接下来我们要在控制器层写好业务逻辑,就是什么情况下直接在调用model层 ...

  9. jade报错:unexpected token

    背景:项目在执行gulp命令构建的时候报了jade错误,错误位置指向的是一个空白行,而这个空白行的上下文都是一些注释,错误信息显示unexpected token "pipeless-tex ...

  10. [转]http://m635674608.iteye.com/blog/1750833

    转载地址:http://m635674608.iteye.com/blog/1750833 在第一次使用TortoiseSVN从服务器CheckOut的时候,会要求输入用户名和密码,这时输入框下面有个 ...