Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL SERVER

SQL SERVER

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lakshmi_sri
    wrote on last edited by
    #1

    how do u do looping in T-SQL?

    F C 2 Replies Last reply
    0
    • L lakshmi_sri

      how do u do looping in T-SQL?

      F Offline
      F Offline
      Farhan Noor Qureshi
      wrote on last edited by
      #2

      I like WHILE loop :)


      Farhan Noor Qureshi

      1 Reply Last reply
      0
      • L lakshmi_sri

        how do u do looping in T-SQL?

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        It depends on what you are trying to do. If you can do the operation using a set based operation (what SQL is optimised for) then you are better doing it that way. If you are looping over a counter then a WHILE loop is useful. If you are looping over rows in a database then you might want to look at CURSORs. However, if you are tempted to use cursors then I would really suggest trying to find a set based method for the same thing first and use CURSORs as a last resort.


        Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups