Q

Identifier field in Microsoft's SQL Server

Ever wonder how to incorporate an Oracle ROWID or identifier field in Microsoft SQL Server? Monitoring and Administration expert Kevin Kline tells you how in this expert response.

I have a table similar to this:
 cust_id trans_dt a0001 12/05/2005 a0002 12/05/2005 a0001 12/05/2005
The table does not have a ROWID or identifier field. I would like to delete the duplicate records and have the results formatted like this:
 a0001 12/05/2005 a0002 12/05/2005 -----------------------
In Oracle there is ROWID to solve this problem. Is there a way to resolve this in SQL Server?
There are a couple ways to accomplish this task. Just because I like fast transactions, I would probably do something like this:

 

  1. SELECT DISTINCT cust_id, trans_dt INTO temp_tbl FROM customertrans
  2. TRUNCATE TABLE customertrans
  3. INSERT INTO customertrans SELECT * FROM temp_tbl

 


Do you have comments on this Ask the Expert Q&A? Let us know.
This was last published in October 2005

Dig Deeper on SQL Server Database Modeling and Design

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close