Solved

Display the actual row the record is saved in SQL 2000

Posted on 2009-05-03
7
274 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure 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 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

822 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