Getting the row id of a row in SQL Server 4.2 and 7.0
In a table of book titles I was working on today, I had a row that I wanted
to copy and change a couple of fields namely Title # and ISBN. Because, I
don't have a primary index on this table(I know bad developer, bad), I just
copied the record as such:
insert into titles
select * from titles where title_id = '99999'
This table had a timestamp field on it. So I thought it would update the
field. And I would be able to tell the difference between the 2 rows, by
looking for the most recently updated row. But, this did not work. It just
copied the field info from the source record.
Which brings me to my question, isn't there a way to get the row id of a
row in a table? And if so, can I perform DML statements on it using the row
id as the key? Something like ...
declare @targetrow int
select @targetrow=max(@@rowid) from titles
where title_id = '99999'
set isbn = '9-9999-9999-X'
where @@rowid = @targetrow
By rperez in forum Database
Last Post: 01-02-2009, 04:14 PM
By blue in forum Database
Last Post: 02-28-2001, 09:42 AM
By Shantha Gowda in forum Database
Last Post: 12-07-2000, 09:18 AM
By Becky in forum Database
Last Post: 07-11-2000, 03:27 PM
By D. Patrick Hoerter in forum Database
Last Post: 06-26-2000, 04:57 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL