Using the ROWGUIDCOL Property : ROWGUIDCOL « Query « SQL Server / T-SQL Tutorial






4>
5> CREATE TABLE Access
6> (ID uniqueidentifier ROWGUIDCOL DEFAULT NEWID(),
7> EID int NOT NULL,
8> AccessTime datetime NOT NULL,
9> DoorID int NOT NULL)
10> GO
1>
2> INSERT Access (ID,EID, AccessTime, DoorID)
3> VALUES (NEWID(),2, GETDATE(), 2)
4> GO

(1 rows affected)
1>
2> SELECT ROWGUIDCOL,
3> EID,
4> AccessTime,
5> DoorID
6> FROM Access;
7> GO
ID                                   EID         AccessTime              DoorID
------------------------------------ ----------- ----------------------- -----------
62DAA92B-B5DE-4404-BD2B-56DC01CA1156           2 2007-10-18 12:06:48.853           2

(1 rows affected)
1>
2> drop table Access
3> GO








1.31.ROWGUIDCOL
1.31.1.Using the ROWGUIDCOL Property