Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Display the actual row the record is saved in SQL 2000

Posted on 2009-05-03
7
275 Views
Last Modified: 2012-05-06
I guess this is a two part question:

1. I would to display the actual row the records are stored in the table

2. Is there a way I can use Select to display a record by just calling the actual row number the record is saved in?
0
Comment
Question by:rayluvs
  • 3
  • 2
  • 2
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24290951
can you explan the big picture, please?
I am not to sure to understand what you are asking for?
0
 

Author Comment

by:rayluvs
ID: 24291003
Ok.

I notice that in SQL when creating a table, there is no "row number" column included, which I understand it would be useless if included.

Ok, to further explain my question: if I create a Table with 3 columns: PatienID, PatienName and PatiendDiagnostics, I would have a SQL table structure of 3 columns.  Finally we populate, import or data entry to this table 99,999 patients.

What I would like to know if SQL does have a row number or record number value stored as it saves data.  And I would like to know if we can display that row number within a Select statement next to each line it displays.








0
 
LVL 17

Assisted Solution

by:OriNetworks
OriNetworks earned 100 total points
ID: 24291006
If I understand correctly, you can return the identity of the inserted row by selecting
SELECT @@IDENTITY
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 17

Expert Comment

by:OriNetworks
ID: 24291010
I just read your last post after I sent mine. It sounds like you are looking for a primary key identity column. You may want to insert a new row with datatype int and set the identity property to true
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 24291012
no, sql server 2000 does not have a "row number".

to store a sequential value for inserted rows, you would use a INT/IDENTITY field.
after the insert, you use SCOPE_IDENTITY()   [@@identity is only to be used in sql7] in the same session to retrieve the value generated by the insert.

other than that, you should not really need a "row number". for ranking, as from sql 2005, you have the ROW_NUMBER() function, among others...
0
 

Author Comment

by:rayluvs
ID: 24291057
Understood, SQL does not store this value.  With methods above in changing one of the columns types or storing sequential values, I can't use it since the table I want to display row-number is already being use for quite sometime; no re-restructure can be done.

Let me put the question this way:

Is there a way that after an INSERT I can recall that record location within the table without querying any of its columns? Some sort of SQL internal function that can display its location?


0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 400 total points
ID: 24291064
short answer: no.

long answer: well, yes. you could query the system to to get the table's data block addresses, and dump those data pages hex data, and try to find the data your are looking for.
but I doubt this is anything you really are looking for, as that is only for dba to fix hard-core issues (like corrupt data pages, or investigating performance issues.)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question