What is the syntax for a for loop in TSQL?
loop 报错
- vi. 打环;翻筋斗
- n. 环;圈;弯曲部分;翻筋斗
- vt. 使成环;以环连结;使翻筋斗
syntax 报错
- n. 语法;句法;有秩序的排列
1
@Macho more info needed – true May 20 '11 at 7:56
8
SQL is a very different language compared to what you're used to. It's focused on what, not how. You tell SQL Server what results you want, and let it figure out how to produce the answer. Or, to repharse what I've just said - there isn't a for loop in SQL. – Damien_The_Unbeliever May 20 '11 at 7:58
3
WHILE @I < 10; SET @I = @I + 1; BEGIN; ...; END? However, this should not be used for most query processing (but is sometimes required for imperative manipulation). Many such instructions/hints are available on google using the search "tsql for loop". – user166390 May 20 '11 at 7:58
5
Avoid loops in favour of JOINs and set operations. – Oded♦ May 20 '11 at 7:59
2
If you are not expert in SQL, you should not be considering using a loop. There are only a few conditions where one is needed and most of the rest of the time, using a loop is the equivalent of pushing your car instead of driving it. Learn to think in terms of data sets instead of looping through records. LOoping is an expert level function not because the syntax is hard but because you need to know exactly how much harm you can do with it before you should be allowed to use it. – HLGEM Aug 14 '13 at 21:06
What is the syntax for a for loop in TSQL?的更多相关文章
- linux shell 报错 Syntax error: Bad for loop variable
在linux下写了一个简单的shell,循环10次. test.sh #!/bin/bash ## ##循环10次 ## ; i<; i++)); do echo Good Morning ,t ...
- linux shell scripts:Syntax error: Bad for loop variable
执行脚本报错 #!/bin/bash s=0 for (( i=1; i<=100; i++ )) do s=$(( $s + $i )) done echo $s sh add.sh 报错: ...
- shell脚本:Syntax error: Bad for loop variable错误解决方法(转)
Linux Mint中写了一个简单的shell脚本,利用for..do..done结构计算1+2+3......+100的值,结果执行"sh -n xxx.sh"检测语法时总是报错 ...
- Syntax error: Bad for loop variable解决办法
从 ubuntu 6.10 开始,ubuntu 就将先前默认的bash shell 更换成了dash shell:其表现为 /bin/sh 链接倒了/bin/dash而不是传统的/bin/bash. ...
- (转)Syntax error:
但是运行时总是报下面这个错,如下: test11-loop.sh: 5: Syntax error: Bad for loop variable 几经查找语法,没有问题,后来在网上找到问题原因: 代码 ...
- Mysql控制语句
14.6.5.1 CASE Syntax 14.6.5.2 IF Syntax 14.6.5.3 ITERATE Syntax 14.6.5.4 LEAVE Syntax 14.6.5.5 LOOP ...
- OpenMP for Fortran
OpenMP for Fortran OpenMP Directive Syntax of OpenMP compiler directive for Fortran: !$OMP Directive ...
- ABAP-语法检查
1.界面 2.代码 *&---------------------------------------------------------------------* *& Report ...
- ubuntu 下执行定时任务
Window shell文件在linux系统下执行不了的解决办法 一些人喜欢用vim来写linux shell script, 但是, 有的人喜欢在Windows下用一些方便的编辑器(比如鼎鼎大名的N ...
随机推荐
- kafka java项目测试使用
引入依赖 <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka_2.11 ...
- 十分钟读懂JavaScript原型和原型链
原型(prototype)这个词来自拉丁文的词proto,意谓“最初的”,意义是形式或模型.在JavaScript中,原型的探索也有很多有趣的地方,接下来跟随我的脚步去看看吧. 原型对象释义 每一个构 ...
- SQL Server MERGE(合并)语句
如何使用SQL Server MERGE语句基于与另一个表匹配的值来更新表中的数据. SQL Server MERGE语句 假设有两个表,分别称为源表和目标表,并且需要根据与源表匹配的值来更新目标表 ...
- day22——从空间角度研究类、类与类之间的关系
day22 从空间角度研究类 何处添加对象属性 在类的______init______可以添加 class Human: mind = "有思想的" def __init__(se ...
- Python如何获取系统大小端模式
1. 第一种方法导入sys模块: >>> import sys >>> >>> sys.byteorder 'little' >>&g ...
- 【题解】Luogu P5304 [GXOI/GZOI2019]旅行者
原题传送门 题意:给你k个点,让你求两两最短路之间的最小值 我们考虑二进制拆分,使得每两个点都有机会分在不同的组\((A:0,B:1)\)中,从源点\(S\)向\(A/B\)中的点连边权为0的边,从\ ...
- 西门子S7-300 设置IP、子网掩码
=============================================== 2019/7/17_第1次修改 ccb_warlock == ...
- 阿里云负载均衡SLB上用免费的Let's Encrypt的SSL证书
Let's Encrypt是很火的一个免费SSL证书发行项目,自动化发行证书,证书有90天的有效期.Let's Encrypt已经发布了工具certbot,用此工具生成证书.证书续期非常简单. 以下是 ...
- MVC学习笔记(二)—用EF创建数据库
1.创建一个空项目 2.在项目中创建EFCore的类库 3.在NuGut控制台为EFCore项目中安装entity 3.1 命令为:Install-Package EntityFramework(在 ...
- linux mount一个目录到另外一个目录
从linux内核2.4.0以后mount支持mount --bind 一个目录到另外一个目录 比如: [root@localhost wind]# mkdir test1 test2 dir3 m ...