1. 程式人生 > 資料庫 >SQL SERVER 類似 Orcal中的rowid

SQL SERVER 類似 Orcal中的rowid

在SQL Server中沒有像Orcal中的rowid,但是可以運用一定的變通達到這個效果。

1、建立臨時表,其中包含rowid,2、重新命名原表後刪除臨時表USE Tianzx

SELECT identity(int,1,1) as rowid,flow.* into temptable from flow--建立臨時表,其中包含rowid

DROP TABLE dbo.訂單資訊對應關係--刪除原有表格
EXEC sp_rename 'tmp_ordermaininfo','訂單資訊對應關係'--重新命名臨時表