Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-08-14 : 18:57:34
|
| I've got a table of statistics with a column that's default is GETDATEIs GETDATE resolution too coarse to be a PRIMARY KEY?CREATE TABLE Mytable ( InsertDate AS DATETIME DEFAULT GETDATE() PRIMARY KEY )I'm worried that it'll run a while then hit a duplicate time on an insert. Is that possible?Sam |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-08-14 : 19:05:19
|
See for yourself:CREATE TABLE Mytable (InsertDate DATETIME NOT NULL)ALTER TABLE Mytable ADD CONSTRAINT PK_InsertDate PRIMARY KEY CLUSTERED ( InsertDate )GOINSERT INTO Mytable VALUES (GETDATE())INSERT INTO Mytable VALUES (GETDATE())INSERT INTO Mytable VALUES (GETDATE())INSERT INTO Mytable VALUES (GETDATE())INSERT INTO Mytable VALUES (GETDATE())INSERT INTO Mytable VALUES (GETDATE())SELECT * FROM MytableDROP TABLE Mytable Tara |
 |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2003-08-14 : 19:07:39
|
| The resolution is approxiamtely 3.33 milliseconds.So of course it is possible. But if it is the key, what is the problem?DavidM"SQL-3 is an abomination.." |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-08-14 : 19:11:36
|
I guess this is a dead-end Oh well Sam |
 |
|
|
|
|
|