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. Record No.

Record No.

Scheduled Pinned Locked Moved Database
databasequestioncsshelp
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.
  • T Offline
    T Offline
    Tuwing Sabado
    wrote on last edited by
    #1

    Hi How can I return the row no. in my query result? Like the presentation of SQL analyzer in GRID VIEW, please help me… e.g. The first column represent the Row No. --------------------------------------- | | field1 | field2 | field3 | --- this is the field header --------------------------------------- | 1 | 1 | dsdfsf | sdfsdd | --- Result with 2 rows --------------------------------------- | 2 | 1233 | asdfsf | wefsdd | --------------------------------------- If you look at my sample the first column represent the row number. If my query look like this “Select * From Table”, How can I return the row number it self with my returning field and row value. Mark

    H 1 Reply Last reply
    0
    • T Tuwing Sabado

      Hi How can I return the row no. in my query result? Like the presentation of SQL analyzer in GRID VIEW, please help me… e.g. The first column represent the Row No. --------------------------------------- | | field1 | field2 | field3 | --- this is the field header --------------------------------------- | 1 | 1 | dsdfsf | sdfsdd | --- Result with 2 rows --------------------------------------- | 2 | 1233 | asdfsf | wefsdd | --------------------------------------- If you look at my sample the first column represent the row number. If my query look like this “Select * From Table”, How can I return the row number it self with my returning field and row value. Mark

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      you should handle this display issue in your client code.. but if you insist to do this in SQL server .. ok here is a sample : set nocount on create table #tempResult (MyID int identity,col1 varchar(30),col2 varchar(30)) insert into #tempResult (col1,col2) Select lastname , firstname from employees set nocount off select * from #tempResult drop table #tempResult

      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