Solved

Display the actual row the record is saved in SQL 2000

Posted on 2009-05-03
7
273 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 142

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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 142

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 142

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now