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. Iterate through Table Rows in sql

Iterate through Table Rows in sql

Scheduled Pinned Locked Moved Database
databasehelp
2 Posts 2 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.
  • M Offline
    M Offline
    Mr Sam
    wrote on last edited by
    #1

    Is it possible to iterate through a table or a temporary, because i have to add a temporary column and insert different values for each row according to condition to return a comma separated value. I show a rough sketch what i want to do. Select SAP.LoginName,var="--Some Very Long Query according to a criteria within the rows of a table like where Test.Folder_ID=CM.Folder_ID--" From dbo.sysCommunicatorMessages CM Inner Join dbo.sysAppLogins SAP On CM.MESSAGEFROM = SAP.LOGIN_ID where "--Some Criteria--" and CM.Folder_ID<>-2 I have used functions to solve the problem but they are currently not acceptable.

    Bye

    P 1 Reply Last reply
    0
    • M Mr Sam

      Is it possible to iterate through a table or a temporary, because i have to add a temporary column and insert different values for each row according to condition to return a comma separated value. I show a rough sketch what i want to do. Select SAP.LoginName,var="--Some Very Long Query according to a criteria within the rows of a table like where Test.Folder_ID=CM.Folder_ID--" From dbo.sysCommunicatorMessages CM Inner Join dbo.sysAppLogins SAP On CM.MESSAGEFROM = SAP.LOGIN_ID where "--Some Criteria--" and CM.Folder_ID<>-2 I have used functions to solve the problem but they are currently not acceptable.

      Bye

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      You could use a CURSOR. Have a look at this article[^].

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      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