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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Using a Date/Time Stamp as a Primary Key

Author  Topic 

rasmasyean
Starting Member

22 Posts

Posted - 2009-07-05 : 08:38:14
Would this work?

I know nowadays with cloud systems and multi-CPU loading, I would guess that there is a chance that the Date/Time Stamp might be duplicated for two records. Is this a correct assumption?

Or is there some mechanism that prevents any two stamps on the same table from being duplicated?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-05 : 13:01:49
yup. datetime values can be same especially if your table is a target for bulk inserts
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-07-05 : 20:14:22
Why not just use an integer identity for a primary key?

CODO ERGO SUM
Go to Top of Page

rasmasyean
Starting Member

22 Posts

Posted - 2009-07-05 : 21:22:36
quote:
Originally posted by Michael Valentine Jones

Why not just use an integer identity for a primary key?

CODO ERGO SUM



Is there an INSERT function that auto-generates an incremental number?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-05 : 22:41:20
identity column will auto increment whenever records are inserted into the table. You don't and should not specify any value to it.
try this

create table #test
(
[ID] integer identity,
[Col] int
)

insert into #test ([Col]) select 100
insert into #test ([Col]) select 200

select * from #test



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rasmasyean
Starting Member

22 Posts

Posted - 2009-07-06 : 09:19:57
Is that "uniqueidentifier" in the design view?
Go to Top of Page
   

- Advertisement -