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 
    

      

    有时候不是我们失去了目标,而是失去了方向。
  • 相关阅读:
    算法设计和分析(Prim算法构建最小生成树)
    寒假第二阶段集训第6天
    2.4 综合训练
    1月18日 LCA专项训练
    易班易喵喵话题动态自动统计
    P2590 [ZJOI2008]树的统计
    P3038 [USACO11DEC]牧草种植Grass Planting
    2157: 旅游
    P2787 语文1(chin1)- 理理思维
    F. Make Them Similar
  • 原文地址:https://www.cnblogs.com/871735097-/p/3867233.html
Copyright © 2011-2022 走看看