zoukankan      html  css  js  c++  java
  • What is the syntax for a for loop in TSQL?

    loop  报错

    英 [luːp]  美 [lup]  口语练习
    • vi. 打环;翻筋斗
    • n. 环;圈;弯曲部分;翻筋斗
    • vt. 使成环;以环连结;使翻筋斗

    syntax  报错

    英 ['sɪntæks]  美 ['sɪntæks]  口语练习 跟读
    • 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 
    

      

    有时候不是我们失去了目标,而是失去了方向。
  • 相关阅读:
    4.5计算机网络笔记
    3.29计算机网络笔记
    3.22计算机网络笔记
    3.15计算机网络笔记
    用int类型表示最大公倍数
    markdown入门
    learning by doing
    技术博客(初用markdown)。
    物联网PPT智能家居王思齐和陈由钧第10组
    第六次java作业
  • 原文地址:https://www.cnblogs.com/871735097-/p/3867233.html
Copyright © 2011-2022 走看看