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