Sql-server – SQL SERVER, SELECT statement with auto generate row id

sql-server

Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.

Best Solution

If you are making use of GUIDs this should be nice and easy, if you are looking for an integer ID, you will have to wait for another answer.

SELECT newId() AS ColId, Col1, Col2, Col3 FROM table1

The newId() will generate a new GUID for you that you can use as your automatically generated id column.